Social Connect
Get more info - setting scope permission (5 posts)

  1. vasikgreif
    Posted 2 years ago #

    Hi, I would need to also get / save user birthdate, when loggin with Facebook. Where shoudl I change the scope?



  2. vasikgreif
    Posted 2 years ago #

    For anyone neeeding this, I changed the scope in media/js/connect.js, like

    window.open('https://graph.facebook.com/oauth/authorize?client_id=' + client_id + '&redirect_uri=' + redirect_uri + '&scope=publish_actions,user_birthday,user_hometown,email',

    Than I just added saving of these fields, like

    $sc_birthday = date('Y-m-d',strtotime($fb_json->{ 'birthday' }));
                $sc_hometown = preg_replace('/^([^,]*).*$/', '$1', $fb_json->hometown->{ 'name' });

    and later

  3. Rodrigo Primo
    Plugin Author

    Posted 2 years ago #

    Thanks for sharing! This might be useful to other users of the plugin.

    Changing the plugin code directly has the disadvantage of complicating future plugin updates in your site.

    If you are interested you could create a new pull request on the GitHub repository (https://github.com/rodrigoprimo/social-connect/) with new hooks so that you could get and save the birthdate without changing the plugin code directly. Others might benefit from those hooks to get and save other user fields.

  4. vasikgreif
    Posted 2 years ago #

    This is difficult to do upgrade safe, as I don't see a way to change the connect.js dynamically.

    Maybe you could help?

  5. Rodrigo Primo
    Plugin Author

    Posted 2 years ago #

    I think you could generate the list of fields to get from Facebook in a PHP file and use wp_localize_script() to pass it to connect.js.

    In the PHP file you could have the default list of fields and a filter if someone wants to change that list.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Social Connect
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic