There is a need to ask a question, but there is no way to write a message. How can I do it?
Theme: https://buddydev.com/bp-redirect-to-profile-plugin-redirect-users-to-their-profile-on-login-on-buddypress-sites/#commentsP.s. Brajesh
Thanks
Hi Andrey,
Welcome to BuddyDev.Please post the question here.
We have changed the blog comment policy to leave it open only for 30 days. It helps us manage better here(In past, we had too many unanswered, un-managed comments on very old posts)Using forums provide a better platform for code sharing, so I encourage it.
I am looking forward to your question.
Regards
BrjeshHi Brajesh,
thanks for your reply.I Inserted in functions.php code but unfortunately it
s doesn
t work : /
How can I find whats the reason is?add_filter( ‘bp_login_redirect’, ‘bpdev_redirect_to_profile’, 11, 3 );
function bpdev_redirect_to_profile( $redirect_to_calculated, $redirect_url_specified, $user ){
if( empty( $redirect_to_calculated ) )
$redirect_to_calculated = admin_url();//if the user is not site admin,redirect to his/her profile
if( isset( $user->ID) && ! is_super_admin( $user->ID ) )
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*/}
I tried through the plugin the same situation.
http://wordpress.org/extend/plugins/bp-redirect-to-profile/Version BP is: 4.1.0
Hi Andrey
Thank you for the question.Are you using a custom theme or any plugin that controls site access?
If yes, Please provide the name/details.
Thank you
BrajeshHi Andrey,
I am sorry, the sweetdate theme uses ajax login and the above code won’t work for that.In the code from my blog post, try changing
bp_login_redirect
withlogin_redirect
. That may work(depends on your settings if reload is not enabled).Regards
BrajeshHi Brajesh,
thanks for your reply.Re-name filter and my code in functions.php look like:
add_filter( ‘login_redirect’, ‘bpdev_redirect_to_profile’, 11, 3 );
function bpdev_redirect_to_profile( $redirect_to_calculated, $redirect_url_specified, $user ){
if( empty( $redirect_to_calculated ) )
$redirect_to_calculated = admin_url();//if the user is not site admin,redirect to his/her profile
if( isset( $user->ID) && ! is_super_admin( $user->ID ) )
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*/}
Unfortunately the result the same : /
Hi Andrey,
I am sorry for the inconvenience.Please post the code to your theme authors and ask them for support. It is most probably theme is controlling the redirect.
The above snippets work on default wp/bp setup.
Regards
Brajesh
You must be logged in to reply to this topic.