BuddyDev

Search

[Resolved] Redirect subpage of members

Tagged: ,

  • Participant
    Level: Enlightened
    Posts: 53
    Jennifer on #25504

    Hi!
    Im searching the way to redirect all subpage of member as /members/jennifer/reviews/ or /members/jennifer/friends/ to the profile of the member /members/jennifer/profile/ when the user is not logged, is it posible?

    Thanks a lot!!
    Jennifer

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #25506

    Hi Jennifier,
    Thank you for the question.

    Please use this code

    
    /**
     * Redirect user to user profile.
     */
    add_action( 'bp_template_redirect', function () {
    
    	if ( bp_is_user() && ! is_user_logged_in() && ! bp_is_profile_component() ) {
    		$profile_link = trailingslashit( bp_displayed_user_domain() ) . bp_get_profile_slug();
    		bp_core_redirect( $profile_link );
    	}
    } );
    
    

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 53
    Jennifer on #25509

    excellent!! thanks very much Brajesh!
    Regards,

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #25510

    You are welcome.

    Regards
    Brajesh

The topic ‘ [Resolved] Redirect subpage of members’ is closed to new replies.

This topic is: resolved