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
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.
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,