Forums

Join
bbPress Support ForumsPluginsAuthentication check on non-WP page

Info

Authentication check on non-WP page

  1. I'm trying to figure out how to verify a user is logged into BBpress before granting access on a non-bbpress page.

    I'm currently trying to use: bb_auth() with limited success. It seems there are a lot of includes necessary. Is there a single file I can include that will load all of the mandatory functions for bb_auth?

  2. I use this to stop people accessing the profile page unless logged-in;

    <?php if ( !bb_is_user_logged_in() ) {
    	show_error_page('log-in to access profiles');
    	exit;
    } ?>

    Something along those line should work with a link to somewhere else, assuming they're in a bbPress page to begin with.

  3. Why not load the bbPress environment and then call function to check is user is logged in? I have done the same in WP, so I think it might be possible in bbPress very easily too.

    For WP

    // load the WP environment so that I can call on the WP functions to make sure that user is logged in before accessing members area
    require( dirname(__FILE__) . '/wp-load.php' ); 
    
    if (!is_user_logged_in()) // You can't access the members area without login. Now can you?
    {
    auth_redirect();
    }

    For bbPress, it should be like

    require('./bb-load.php');
    // find the name of the function you will need
  4. You must log in to post.