Skip to:
Content
Pages
Categories
Search
Top
Bottom

forums/users/ only for logged in users?


  • laberkopp
    Participant

    @laberkopp

    Dear all,

    we are setting up bbpress forums for our internal organisation (about 200 members).
    For different reasons the complete forums user profile pages at ../forums/users/<username> shall not be visible to visitors of our page (users that are not logged in).

    For example, this page https://ak-asyl-walldorf.de/forums/users/sascha should not be seen at all when you are not logged in. Only when you are logged in with a registered user account you should be able to have access to those pages.

    How can I configure this?

    Best regards,
    Sascha

Viewing 5 replies - 1 through 5 (of 5 total)
  • Guten Abend laberkopp,

    @robin-w

    I checked your profile picture and I think I have seen you before 🙂

    bbPress profiles are open by default to all, so also users that are not logged in could see your profile. I know Robin has made a quick patch for a previous version (http://www.rewweb.co.uk/bbpress-making-profile-pages-private/) but I’m not sure if it’s still valid for the current version.

    Some other (untested!) snippets can be found here: http://seventhqueen.com/blog/code-snippets/restrict-guest-users-from-accessing-buddypress-or-bbpress-pages.html

    Regards, Pascal.


    laberkopp
    Participant

    @laberkopp

    Thanks casiepa!

    I hoped for a solution without coding, but it seems I need to start digging into the fundaments of WP and bbpress.

    I will go for the @robin-w solution first, as from the other one I didn’t even get where to put the code and what kleo should be.

    So thanks again, I will get back here as soon as I have something to report.

    Best wishes,
    Sascha


    Robkk
    Moderator

    @robkk

    You can use this php Code function instead if you are not using BuddyPress. Make sure to place it in your child themes functions.php file or in a functionality plugin.

    What it does is redirect non-logged in users from see user profile pages to the default WordPress login page.

    You can change the page by editing

    site_url('wp-login.php');

    to something like this if you have a yoursite.com/login page instead.

    site_url('/login/');

    function rkk_restrict_bbp_user_pages() {
    
        if ( ! is_user_logged_in() ) {
    
           if ( bbp_is_single_user() ) {
    
                        $url = site_url('wp-login.php');
    
                            // Send them to the new URL
                        wp_redirect( $url );
    
                        exit;
    	}
        }
    }
    add_action( 'template_redirect', 'rkk_restrict_bbp_user_pages');

    laberkopp
    Participant

    @laberkopp

    Thanks @robkk I may come back to your suggestion.


    @all

    I just tested the solution from @robin-w where @cassiepa pointed me to and this works very nicely for me. It is already active and seems not to influence other parts of my site. You can try if you like (link in first post 🙂

    What I like on that solution, is that I just need to add two files and do not need to edit and replace an existing file.

    Let’s see what will happen when I need to update the theme (if subfolder and files keep untouched, I mean).

    But for now I am yery happy. This was easier than I’ve feared 🙂

    Thanks a lot to all of you! I love communities 🙂
    Best wishes,
    Sascha

    Hi,

    If you are still interested, I have added it into my bbP Toolkit. It does NOT need any files to be copied or created. https://wordpress.org/plugins/bbp-toolkit/

    Pascal.

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