Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Two questions about the login process


Kapil
Participant

@techkapil

I got into same situation and found solution based on @jotem ‘s filter
You can use bp_core_get_userlink($user->id) instead of bp_core_get_userurl($user->id). But its lil bit tricky.
bp_core_get_userlink ($user_id) function returns anchor tag and echo it on the screen. So the login redirection process is halted .

Instead of that,


function rt_login_redirect($redirect_to, $set_for, $user){
$redirect_to = bp_core_get_user_domain($user->id);
return $redirect_to;
}
add_filter(‘login_redirect’, ‘rt_login_redirect’, 20, 3);


bp_core_get_user_domain() function will give the profile url without echoing anything.
One more important thing is priority in add_filter of login_redirect. Make sure that your function executes @ the last.

One more tricky situation is many time business logic is such a that the redirection process must be done depending on the type of the user. In that case, you have $user->id in rt_login_redirect(). Once you get the user_id, you can put business logic and modify $redirect_to according to your need!

P.S. Trying to echo any value in this function will give u output but the redirection process will not complete.
@Life2000
@arxpoetica @damainman @hnla Are you looking for same???

Skip to toolbar