Last active
January 9, 2020 20:25
-
-
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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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