BuddyDev

Search

[Resolved] BP profile visibility redirec option.

  • Participant
    Level: Master
    Posts: 213
    smart life on #14181

    OPTION Protected Profile Policy:

    There is no option redirect to “custom URL or homepage example” can you please update? Or give me code to redirect to homepage?

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #14182

    Hello Julia,

    Please use the following url in your “bp-custom.php” file to redirect user on home page.

    
    function buddydev_redirect_user_on_restricted_profile( $location ) {
    	$location = get_home_url(); // For home url
    	return $location;
    }
    add_filter( 'bp_profile_visibility_redirect_location', 'buddydev_redirect_user_on_restricted_profile' );
    
    

    Regards
    Ravi

  • Participant
    Level: Master
    Posts: 213
    smart life on #14191

    Hi,

    Thank code worked.

    Another question:

    I also use bellow “code snippet” to auto redirect user who is normal login (NOT first time) redirect to PROFILE page

    https://buddydev.com/buddypress/buddypress-trick-redirect-users-to-their-profile-on-login/

    This code is not work, when user normal login it always reload at current page. Can you help me check the code?

    P/S: My theme defaul coded redirect for user login to current page, there is no other option in theme.

    Thanks

  • Participant
    Level: Master
    Posts: 213
    smart life on #14194

    Hi, I fixed issue.

    Now what is the code spinned also restrict /members page for none logged in user redirect to home page?

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #14195

    Hello Julia,

    Thank You for acknowledgement. Use the following code.

    
    function buddydev_members_directory_redirect() {
    
    	if ( bp_is_members_directory() && ! is_user_logged_in() ) {
    		bp_core_redirect( get_home_url() );
    	}
    }
    
    add_action( 'bp_template_redirect', 'buddydev_members_directory_redirect' );
    

    Thank You
    Ravi

  • Participant
    Level: Master
    Posts: 213
    smart life on #14196
  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #14207

    Hi Julia,
    Please do mark a topic as resolved when it is fixed. It helps us manage the support better.

    I am looking at your other issue now.

    Thank you.
    Brajesh

The topic ‘ [Resolved] BP profile visibility redirec option.’ is closed to new replies.

This topic is: resolved