Facebook email address not stored in WordPress profile

Hello - I just successfully installed the Social Login WordPress plugin from OneAll. I am hoping to collect email address from our users who log in thru Google & Facebook. A Google email address passes thru and is stored successfully in the user's wordpress profile. However, when logging in thru Facebook the plugin seems to always provide a default email address. Other FB info (Name, link to user's FB page) is being stored in Wordpress perfectly. I would appreciate any settings to tweak that might help gather email address as well. Thanks!

Answers

  • I ran a REST call against the OneLogin API to see what Facebook returned and the email address of my user was returned successfully as part of the JSON.

    ..snip...
    "gender": "male",
    "utcOffset": "-5:00",
    "emails": [
    {
    "value": "[masked user email]@gmail.com",
    "is_verified": true
    }
    ],

    Still trying to figure out how to get this email address to save to the user's email field in WordPress. Thanks!
  • Hi,
    It can happen that a Facebook user does not provide an email address.
    You mention you tested the REST API, but was it for the same user whose email address was missing in Wordpress?
    Also, you can have the plugin ask for an email address when none is available in the profile (in the plugin settings under the admin interface).
    Finally, you can add an action (theme's functions.php file) to log the user's social profile when registering:
    add_action( 'oa_social_login_action_before_user_insert', 'oa_log_user', 10, 2 );
    function oa_log_user( $user_fields, $social_profile ) { error_log( print_r( $user_fields, true ); }

Welcome!

Please sign in to your OneAll account to ask a new question or to contribute to the discussions.

Please click on the link below to connect to the forum with your OneAll account.