[英]How to redirect logged users to a custom page in buddypress & wordpress
I am trying too redirect every logged users to a specific page of their profile...See this example page.. this site is build on wp and bp. 我正在尝试将每个登录的用户也重定向到他们的个人资料的特定页面...请参阅此示例页面..该站点是基于wp和bp构建的。 I am using BP Profile as Homepage plugin for logged in user redirection... this see this code ...
我正在使用BP Profile作为主页插件来登录用户重定向...看到此代码...
function bp_profile_homepage()
{
global $bp;
$selected_role = get_option('bpahp_role_choice');
if($selected_role == '')
{
if(is_user_logged_in() && bp_is_front_page())
{
wp_redirect( $bp->loggedin_user->domain );
}
}
else
{
if(!current_user_can($selected_role) && bp_is_front_page())
{
wp_redirect( $bp->loggedin_user->domain );
}
}
}
So after using this plugin i am able to redirect my user to their profile page automatically when they logged in.. http://www.example.com/members/admin/ 因此,使用该插件后,我可以在用户登录时自动将其重定向到他们的个人资料页面。http://www.example.com/members/admin/
but i want to redirect them to this page 但我想将他们重定向到此页面
http://www.example.com/members/admin/activity/all-activity/ http://www.example.com/members/admin/activity/all-activity/
All activity is a sub page of activity directory in which i am showing all activities to users sitewide.. i do not want to send them on site wide activity page for seeing activity i want to show them all that on their profile page.. 所有活动是活动目录的子页面,我在其中将所有活动显示给站点范围内的用户。.我不想在站点范围内的活动页面上发送它们以查看活动,我想在其个人资料页面上显示所有活动。
So any idea what to add in this code wp_redirect( $bp->loggedin_user->domain ); 所以任何想法在此代码中添加什么wp_redirect($ bp-> loggedin_user-> domain);
to make it workable with my requirement.... I have tried so many tricks for making my requirement workable but do not get success..i have also tried to replace this code 使它可以满足我的要求。...我尝试了很多技巧使我的要求可行,但没有成功..我也尝试替换此代码
wp_redirect( $bp->loggedin_user->domain );
with this one... $redirect_url = "$bp->loggedin_user->domain/activity/all-activity/"; 有了这个... $ redirect_url =“ $ bp-> loggedin_user-> domain / activity / all-activity /”;
wp_redirect( $redirect_url ); wp_redirect($ redirect_url);
And this one 还有这个
$redirect_url = "activity/all-activity/";
wp_redirect( $bp->loggedin_user->domain/$redirect_url );
Nothing is working Please somebody help me.. 没事,请有人帮我..
关于什么:
wp_redirect( $bp->loggedin_user->domain . '/activity/all-activity/' );
Below code is used to redirect the use to buddypress profile page after login 以下代码用于在登录后将使用重定向到buddypress个人资料页面
function bp_help_redirect_to_profile(){
global $bp;
if( is_user_logged_in() && is_front_page() ) {
bp_core_redirect( get_option('home') . '/members/' .
bp_core_get_username( bp_loggedin_user_id() ) . '/profile' );
}
}
add_action( 'get_header', 'bp_help_redirect_to_profile',1);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.