Skip to:
Content
Pages
Categories
Search
Top
Bottom

Logged in home page


  • UgoDimma
    Participant

    @lovecoinz

    Hey Buddy’s

    I am using a static page for my home page, but I want to have a different home page for logged in users.

    I created a page with name home, which am using as home page, But now I want to use a buddypress profile friends activity page as a home page for all loged in users, so that once they are logged in and click on the site logo or home button it will redirect them to mysite.com/members/username/activity/friends.

    How can I get this to work for me?

    Am using wordpress 4.3 and buddypress 2.3.3 as at the time of posting this topic.

Viewing 2 replies - 1 through 2 (of 2 total)

  • danbp
    Moderator

    @danbp

    To redirect your users to their friends activities page on login, you can use this:

    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
    	$url = bp_core_get_user_domain( $user->ID ) .'activity/friends/';
    
        if( isset( $user->ID) && ! is_super_admin( $user->ID ) )
            return $url;
        else
            return $redirect_to_calculated; /*if site admin or not logged in,do not do anything much*/
     
    }
    add_filter( 'bp_login_redirect', 'bpdev_redirect_to_profile', 11, 3 );

    Snippet source: http://buddydev.com/buddypress/buddypress-trick-redirect-users-to-their-profile-on-login/

    To add a home button to the main menu, use WP’s menu builder. But this doesn’t let you add a dynamic button going to EACH user profile, only to yours. You will have to code this.

    See from here how to do this:
    https://buddypress.org/support/topic/how-to-get-notification-count-code/#post-244069
    You need to introduce this:
    $url = bp_core_get_user_domain( $user->ID ) .'activity/friends/';


    UgoDimma
    Participant

    @lovecoinz

    @danbp
    Thanks for the code, but is their a way I can override the default home page for logged in users, so that it will keep on redirecting to friends activity on click?

    The code you provided only works on after login.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Logged in home page’ is closed to new replies.
Skip to toolbar