Free Directory, Listing & Classifieds WordPress Plugin Support Extensions Memberships Restrict bbPress forum pages to members only

Restrict bbPress forum pages to members only

  • Author
    Posts
  • ihordeveloper

    If you want restrict bbPress forum pages to members only, you can use this code snippet:

    add_action(
    	'template_redirect',
    	function() {
    		if ( current_user_can( 'edit_others_posts' ) || ! function_exists( 'hivepress' ) || ! class_exists( 'bbpress' ) ) {
    			return;
    		}
    
    		if ( is_bbpress() && ! hivepress()->request->get_context( 'membership' ) ) {
    			wp_safe_redirect( hivepress()->router->get_url( 'membership_plans_view_page' ) );
    
    			exit;
    		}
    	}
    );
    shadiHD

    Will non bbpress members be able to view these forum pages? Do only bbpress members have access to post?

    ihordeveloper

    This code redirects all bbPress pages to the plans page, so non-members will not be able to view forum pages or post anything.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Subscribe

Sign In

Don't have an account? Register

Forgot password?

Register

Already have an account? Sign In

Forgot password?

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.