Email variables

0 favourites
  • 7 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hi everyone. I need some assistance if possible with a facebook app I'm creating.

    facebooklogin.php

    I can pull up all the variables as you can see, but when I assign it to a variable or array instance as a text and then assign the variable to a textbox it doesn't show up. If you go to

    My game site

    and click on create it brings you to the page that shows other info. But the email text box is not showing up. I know I'm using tokenat properly as the other items are showing up. Is there a different type of variable to use when storing an email address?

  • Update: haven't checked but I think I found the problem. Safari shows it fine. Not in front of the pc but I'm thinking the size of the text box and how different browsers display the fonts might be to blame and I just need to resize the text box? Is there a way to resize it dynamically at runtime based on length of the string?

  • your facebooklogin.php doesn't come his e-mail.

    I have no experience about facebook API, i guess it comes a SDK for PHP

    there a snippet you may test it:

    $loginUrl = $facebook->getLoginUrl(

    array(

        'req_perms' => 'email'

    )

    );

    echo '<script>top.location="'.$loginUrl.'";</script>';

    die();

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • or this

    <?php

        $facebook = new Facebook(array(

          'appId' => $initMe["appId"],

          'secret' => $initMe["appSecret"],

        ));

        $facebook->setAccessToken($initMe["accessToken"]);

        $user = $facebook->getUser();

        if ($user) {

            $user_profile = $facebook->api('/me');

            print_r($user_profile["email"]);

        }

    ?>

  • It does echo back the email as well. I figured it out. Had something to do with the text box layout. It's showing up fine now. Setting the email up was a pain though, had to ask for an extra permission in order to receive it. You were able to see my php file? Any obvious errors? It seems to work fine. Heres a copy of it, I'm new to php so I'll take any help I can get. :)

    <?

    // Remember to copy files from the SDK's src/ directory to a

    // directory in your application on the server, such as php-sdk/

    require_once('facebook.php');

    $config = array(

        'appId' => 'xxxxxx',

        'secret' => 'xxxxxxx',

    );

    $facebook = new Facebook($config);

    $user_id = $facebook->getUser();

    ?>

    <?

        if($user_id) {

          // We have a user ID, so probably a logged in user.

          // If not, we'll get an exception, which we handle below.

          try {

            //$info = $facebook->api( '/me/groups', 'GET');

            //$ct = count( $info['data'] );

            //$user_groups = $facebook->api('/me/groups','GET');

            $user_profile = $facebook->api('/me','GET');

            echo $user_profile['name'] . "," . $user_profile['link'] . "," . $user_profile['id'] . "," . $user_profile['first_name'] . "," . $user_profile['last_name'] . "," . $user_profile['username'] . "," . $user_profile['email'] . "," . $user_profile['gender'] . "," . $user_profile['timezone'] . "," . $user_profile['locale'] . "," . $user_profile['verified'] . "," . $user_profile['updated_time'];

           

          } catch(FacebookApiException $e) {

            // If the user is logged out, you can have a

            // user ID even though the access token is invalid.

            // In this case, we'll get an exception, so we'll

            // just ask the user to login again here.

            $login_url = $facebook->getLoginUrl();

            echo 'Please <a href="' . $login_url . '">login.</a>';

            error_log($e->getType());

            error_log($e->getMessage());

          }   

        } else {

          // No user, print a link for the user to login

          $login_url = $facebook->getLoginUrl();

          echo 'Please <a href="' . $login_url . '">login.</a>';

        }

    ?>

  • PHP files can be viewed on server side, NOT client side.

    I think you need to ask for extended permissions to display e-mail:

    $params = array(

    'scope' => 'email, user_activities',

    'redirect_uri' => 'https://www.myapp.com/post_login_page'

    );

    $loginUrl = $facebook->getLoginUrl($params);

    developers.facebook.com/docs/authentication/permissions

  • I did through the app center. If you follow the link to my game you'll see email listed as a permission and my create screen now shows the email address properly. Thanks for the quick replies though

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)