jospabloorozcomarn
  • 0
Учитель

BuddyPress – перенаправления при входе и выходе из системы

  • 0

Используя BP, можно:

1. On login redirect to member profile.

2. On logout redirect to facebook.com

Заранее спасибо.

Share
  1. Вот как вы входите на страницу профиля.

    /*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>
    
    • 0

Оставить ответ

You must login to add an answer.