Skip to content

Instantly share code, notes, and snippets.

@timersys
Last active January 9, 2020 20:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timersys/f76e15882073c47053b99c70509a0c89 to your computer and use it in GitHub Desktop.
Save timersys/f76e15882073c47053b99c70509a0c89 to your computer and use it in GitHub Desktop.
Custom scopes with Facebook Login WordPress plugin https://timersys.com/plugins/facebook-login-pro/
<?php
/**
* Collect custom scopes with Facebook Login WordPress plugin
* https://timersys.com/plugins/facebook-login-pro/
**/
// Change default scopes
add_filter('fbl/app_scopes', function( $scopes ) {
return 'email,public_profile,user_posts'; // pass custom scopes
});
// change fields to retrieve
add_filter( 'fbl/js_auth_data', function( $vars ) {
$vars['fields'] = 'id,first_name,last_name,email,link'; // pass fields needed
return $vars;
});
// do something with data
add_action( 'fbl/after_login', function( $user, $user_id, $facebook_data ) {
var_dump($facebook_data); // check returned data and do something with it
...
},10,3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment