login_redirect
-
HI there,
I have a mobile version of my website at mywebsite.com/mobile and there is a login form which posts to wp-login.php. Currently, when users login from the homepage, they are redirected to their buddypress profile if they are not admin. I would like to keep this in place if they login from the home page, but if they login from mywebsite.com/mobile I would like them to be redirected to mywebsite.com/mobile/dash . Anybody have some advice to offer?
//REDIRECT USERS TO ACTIVITY PAGE WHEN THEY LOGIN
add_filter(“login_redirect”,”bpdev_redirect_to_profile”,10,3);function bpdev_redirect_to_profile($redirect_to_calculated,$redirect_url_specified,$user)
{
if(empty($redirect_to_calculated))
$redirect_to_calculated=admin_url();
/*If logging in from website.com/mobile (which has a login form which posts to wp-login.php, redirect to website.com/mobile/dash *//*if the user is not site admin,redirect to his/her profile*/
if(!is_site_admin($user->user_login))
return bp_core_get_user_domain($user->ID );
else
return $redirect_to_calculated; /*if site admin or not logged in,do not do anything much*/}
- The topic ‘login_redirect’ is closed to new replies.