Support » Plugin: Social Login & Register for Wordpress - 40+ Social Networks » Facebook account without email

  • Resolved abouemish

    (@abouemish)


    Hello,

    Thanks for your work and efforts.

    Is it possible to change the pattern of placeholder email for facebook user account without email?

    In other words, instead of [random-string]@[placeholder.com] i want to use [facebook-user-Id]@[fb-default-or-whatever-i-need.com]

    This is because i had the same behaviour in home made cms and i need to migrate those users to wordpress

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter abouemish

    (@abouemish)

    Another solution that will work for me is it’s possible to you,

    to use facebook-user-id as the username and validate is_exiting in each login with the facebook-user-id not full name

    Thread Starter abouemish

    (@abouemish)

    I had a look on filters, but all filters are called later after checking user logic already executed.

    Maybe we need a new filter to override user name and email values, and called before checking user existence.

    Plugin Author Claude

    (@claudeschlesser)

    Hello,

    I think that something like this could do the trick:

    function oa_social_login_update_data ($user_data, $identity)
    {
    	if (preg_match ('/@example.com$/', $user_data->email))
    	{
    		if ($identity->source->key == 'facebook')
    		{
    			wp_update_user(array( 
    				'ID' => $user_data->ID, 
    				'user_email' => $identity->accounts[0]->userid.'@fb-default-or-whatever-i-need.com'
    			));
    		}
    	}
    }
     
    //This action is called whenever Social Login adds a new user
    add_action ('oa_social_login_action_after_user_insert', 'oa_social_login_update_data ', 10, 2);

    The code will be triggered whenever a new user is being added. If it’s a placeholder email AND a Facebook login, then the user’s email is being updated to fb-userid@fb-default-or-whatever-i-need.com.

    This code is untested!

    • This reply was modified 5 years, 2 months ago by Claude.
    • This reply was modified 5 years, 2 months ago by Claude.
    Thread Starter abouemish

    (@abouemish)

    Thanks Claude for you answers,

    I found that plugin check if user exists based on $user_token meta, so changing the email will not help.

    i want to change the behavior and check if user exists or not based on $identity->accounts[0]->userid “Social Provider Key” because this is what i have in my existing CMS.

    i was able to do that by making the small changes in the plugin, but of course i will lose those changes if i updated the plugin

    Can you add a filter that customize what is the value of $user_token ?

    to add this line
    $user_token = apply_filters (‘oa_social_login_filter_get_user_token’, $user_data);

    So

    // Unique user token provided by OneAll.
    $user_token = $user_data->user_token;

    will be

    // Unique user token provided by OneAll.
    $user_token = $user_data->user_token;
    $user_token = apply_filters (‘oa_social_login_filter_get_user_token’, $user_data);

    Kind Regards,

    Plugin Author Claude

    (@claudeschlesser)

    Hello,

    thank you so much for the debugging and for the proposed solution.
    We will add the filter to the next release!

    Best Regards,

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Facebook account without email’ is closed to new replies.