Skip to:
Content
Pages
Categories
Search
Top
Bottom

Authentication check on non-WP page

  • @yutt

    Member

    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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • @michael3185

    Member

    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.

    @ashfame

    Participant

    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

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