0

I would like to know How can i redirect users to their profile after they log in to my website.

Right now, when users log in, they get riderected to the home page but i would like for them to get redirected to their respective profile.

thanks in advance

1
  • Please show us what have you tried so far. May 29, 2015 at 3:15

3 Answers 3

1

Try:

function custom_user_login_redirect( redirect_to, $redirect_to_raw, $user ) {
   $redirect_to = bp_loggedin_user_domain();
   return $redirect_to;
}
add_filter('bp_login_redirect','custom_user_login_redirect',10,3);
1
  • Thanks @shanebp it didnt work but you have pointed me towards the right way Jun 2, 2015 at 12:27
0

You can use the wp_authenticate-hook (see Codex) to trigger a function, when a user was successfully logged in and then use wp_redirect (see Codex) to bringt him to a specific page.

add_action ('wp_authenticate' , 'redirect_to_profile');

function redirect_to_profile() {
   $user_profile_url = 'getthisfromwhereever...';
   wp_redirect($user_profile_url);
   exit;
}
2
  • Thanks @flomei! It didnt work but you have pointed me towards the right way. Jun 2, 2015 at 12:26
  • You´re welcome. It would be great if you could post your final answer, so others can learn from how you did it.
    – flomei
    Jun 2, 2015 at 14:36
0

You can try BP Login Redirect

Plugin description:

Allows to decide buddypress website admins where their users should land after log in

enter image description here

1
  • Hey guys, thanks for your comments and for your help, i greatly appreciate it. In the end, i downloaded an app called ultimatemember, in which it allows me to control just about everything with members. Its better than buddypress and i recommend it to you if you are tyring to build a community. Note- i am not affiliated to the plug in, in any way Aug 11, 2015 at 0:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.