Exclude admin from redirect login
-
I’m using the following code to redirect users to the profile page upon login. But I would like the admin to redirect to dashboard. Can I add a line of code to exclude admin from being redirected to profile page?
add_filter("login_redirect","bpdev_redirect_to_profile",100,3); function bpdev_redirect_to_profile($redirect_to_calculated,$redirect_url_specified,$user) { /*if no redirect was specified,let us think ,user wants to be in wp-dashboard*/ if(empty($redirect_to_calculated)) $redirect_to_calculated=admin_url(); /*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*/ }
Thanks,
John
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Exclude admin from redirect login’ is closed to new replies.