Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Václav Greif

    (@vasikgreif)

    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',
    				'','scrollbars=no,menubar=no,height=500,width=800,resizable=yes,toolbar=no,status=no');

    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

    update_user_meta($user_id,'birthdate',$sc_birthday);
     update_user_meta($user_id,'city',$sc_hometown);
    Plugin Author Rodrigo Primo

    (@rodrigosprimo)

    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.

    Thread Starter Václav Greif

    (@vasikgreif)

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

    Maybe you could help?

    Plugin Author Rodrigo Primo

    (@rodrigosprimo)

    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Get more info – setting scope permission’ is closed to new replies.