C2 Facebook plugin + email

0 favourites
  • 4 posts
From the Asset Store
A cool way for kids to write and practice English Alphabets
  • Hello guys,

    I know how to use the Facebook plugin very well. I used it in one of our games and it worked perfect. Facebook login, ranking, etc.

    The thing is that I need the same basic functionalities plus facebook user email. No more else, that's why I don't want to try the advanced Facebook third party plugins. The one that comes with C2 works pretty well.

    Does anybody know how to do this?

    I've read that user email needs special permissions, so I think it's not that simple as adding the var email in the plugin code and I don't have experience creating or modifying plugins.

    Thank you in advance :)

  • Ok, i'll give you few hints where to start, and hopefully you'll finish this edit on your own.

    Open up folder where facebook plugin is, and open runtime.js in notepad++. First we'll have to ask user for a permission to access email. Scroll to the line 232 and add this line of code:

              if (fbCanPublishStream) {


                             // ask for email access



    You'll have to request 'publish to stream' in C2 to get access for email in this case.

    Then we'll throw the email to the log somwhere on the line 55 where you'll see this:

    function onFBLogin()


              if (!fbLoggedIn)


                   fbLoggedIn = true;

                   fbRuntime.trigger(cr.plugins_.Facebook.prototype.cnds.OnLogIn, fbInst);


                   FB.api('/me', function(response) {

                                       fbFullName = response["name"];

                                       fbFirstName = response["first_name"];

                                       fbLastName = response["last_name"];

    /// we'll access email here, if you want to have it as expression inside construct do it same as for first_name, or last_name. Don't forget to add an expression in edittime.js


                                       fbRuntime.trigger(cr.plugins_.Facebook.prototype.cnds.OnNameAvailable, fbInst);




    That's about it. you have access to email. As for getting email as an expression inside C2, i left that for your enjoyment in exploring the beautiful C2 sdk. :)

  • JohnnySheffield so nice of you! That's more than enough :D :D :D I will try it and tell you the results. Hope it works. Thank you very much... very very clear.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • JohnnySheffield really great

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