Plugin Author
Claude
(@claudeschlesser)
Hello,
the following filters are available to customize the redirection:
//Redirection for new users
function oa_social_login_filter_redirect_for_new_users ($url, $user_data)
{
//Force the url to something else
$url = 'http://my-website.com/welcome-new-user/';
//New users will be redirected here
return $url;
}
add_filter('oa_social_login_filter_registration_redirect_url', 'oa_social_login_filter_redirect_for_new_users', 10, 2);
//Redirection for existing users
function oa_social_login_filter_redirect_for_existing_users ($url, $user_data)
{
//Force the url to something else
$url = 'http://my-website.com/welcome-back/';
//Returning users will be redirected here
return $url;
}
add_filter('oa_social_login_filter_login_redirect_url', 'oa_social_login_filter_redirect_for_existing_users', 10, 2);
The codes have to be added to the end of the functions.php file of your WordPress theme.
Regards,
Hi Claude,
I need a help.
I used your above code. It works, but not in my case. I’m trying to redirect to user’s profile edition (buddypress) to make him/her to fill all required fields.
To do it I need to get user name.
It works fine when user logs in normal way.
But when I login via facebook I get empty current_user object and bp_user_id=0 as well.
This way I get:
http://websiteurl.com/profile/edit/group/1/
from:
$profile_path = $current_user->user_login . "/profile/edit/group/1/";
In above $profile_url user name is empty.
I added your filters. First I added with priority 10 as you did it, then I changed to 100 with hope it helps. I hoped later call of the filter allows another piece of code to be run first. Of course, it didn’t help.
What am I doing wrong?
Is there any other action to be called right after registration/login?
Regards,
Bernard
There isone more option for me.
Can I disable the redirecting actions?
@blatan : I also wanted to redirect to user profile after oneall socila login completed.Please use the below code in your current theme function.php file
/*** Forcing redirect to $_SESSION['specific_referer'] after registration & login in OneAll Social Login ***/
add_filter('oa_social_login_filter_registration_redirect_url', 'my_login_registration_redirect_filter', 10, 2);
add_filter('oa_social_login_filter_login_redirect_url', 'my_login_registration_redirect_filter', 10, 2);
function my_login_registration_redirect_filter ($url, $user_data) {
$url = site_url()."/members/".$user_data->data->user_nicename;
return $url;
}
You are done !!! enjoy