BuddyPress-登录和注销时重定向

时间:2011-04-18 作者:José Pablo Orozco Marín

使用BP有一种方法可以:

1. On login redirect to member profile.

2. On logout redirect to facebook.com
提前谢谢。

1 个回复
最合适的回答,由SO网友:Jeremy Love 整理而成

下面是您如何登录到配置文件页面的。

/*Add a filter to filter the redirect url for login*/
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*/

}
这里是注销到facebook

add_filter(\'allowed_redirect_hosts\',\'allow_ms_parent_redirect\');
function allow_ms_parent_redirect($allowed)
{
    $allowed[] = \'facebook.com\';
    return $allowed;
}

<a href="<?php echo wp_logout_url( \'http://facebook.com\' ); ?>" title="Logout">Logout</a>

结束

相关推荐

URL redirect problem

我的wordpress 3.0.1站点中有2个页面,包含2个URLwww.mysite。co.uk/sub-page/child-of-sub-page/acculation/和www.mysite。co.uk/conditionment公司/但是,我的网站中的任何链接都可以链接到www.mysite。co.uk/acculation/访问www.mysite。co.uk/sub-page/child-of-sub-page/acculation/代替这是wordpress 3.0.1中的错误吗?还是有办