Skip to:
Content
Pages
Categories
Search
Top
Bottom

Profile Page visible to non-logged-in visitors

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

  • thoo
    Participant

    @thoo

    I’m having the same problem. Does anyone have a solution for this?

    Thanks!


    Robin W
    Moderator

    @robin-w

    The normal behaviour is to allow anyone to see profiles.

    You can limit this to only logged in users by adding some code to a couple of files.

    If you have c-panel or ftp access and know how to transfer files, come back and I’ll help you with the changes.


    thoo
    Participant

    @thoo

    I see.

    Yes, I have access and can transfer files. Further help much appreciated.


    Robin W
    Moderator

    @robin-w

    Ok, I created the changes needed – go to my site and download the changed files – instructions are there

    bbPress – Making Profile Pages Private

    Come back if you have any queries


    Prabin
    Participant

    @prabin04

    hi @robin-w, didn’t work 😞


    Robin W
    Moderator

    @robin-w

    It should still work.

    can you tell, me what your theme is?


    sharojit
    Participant

    @sharojit

    Hey, It does not work for me either.


    Jakobuz
    Participant

    @jakobuz

    Maybe you mean the buddypress profile page?
    in that case this piece of code in the functions.php of your theme might help:

    function sh_walled_garden()	{
    	global $bp;
    	if( bp_is_register_page() || bp_is_activation_page() )
    	return;
    	if( ! bp_is_blog_page() && ! is_user_logged_in() )
    	bp_core_redirect( $bp->root_domain .'/'. 'LOGIN_PAGE_NAME' );
    }
    add_action( 'get_header', 'sh_walled_garden' );

    ‘LOGIN_PAGE_NAME’ = whatever page name you use to login


    Jakobuz
    Participant

    @jakobuz

    and in case if the plugin Buddypress is not installed, something like this might be useful:

    // redirect if the url contains the word 'user' and if you are not logged-in
    add_action('init', 'profile_redirect');
    function profile_redirect() {
    if(strpos($_SERVER['REQUEST_URI'], 'user') !== false &&  ! is_user_logged_in()) {
    	wp_redirect("https://www.whateversite.com/" . LOGIN_PAGE_NAME);
    	}
    }

    ‘LOGIN_PAGE_NAME’ = whatever page name you use to login.
    Change the word ‘user’ to your needs.

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.
Skip to toolbar