Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Can we restrict ALL access to BuddyPress or bbPress?

$
0
0

Replies: 0

Hi ya,
I really would like to be able to just overall stop access to BuddyPress / bbPress pages. Including the autogenerated pages like /members/ and so on.

I’ve seen other code around that does it that we have to add to the functions.php.

/**
* Redirect buddypress and bbpress pages to registration page
*/
function page_template_redirect()
{
    //if not logged in and on a bp page except registration or activation
    if( ! is_user_logged_in() &&
        ( ( ! bp_is_blog_page() && ! bp_is_activation_page() && ! bp_is_register_page() ) || is_bbpress() )
    )
    {
        wp_redirect( home_url( '/' ) );
        exit();
    }
}
add_action( 'template_redirect', 'page_template_redirect' );

This may be something of a large hammer, but you get the idea. I expect you could make something rather more granular, but having the option to just stop access to all those pages would be very helpful.

Cheers


Viewing all articles
Browse latest Browse all 59525

Trending Articles