Forums

Join
bbPress Support ForumsTroubleshooting[resolved] force login for bbpress 1.0.1

Info

[resolved] force login for bbpress 1.0.1

  1. can i somehow make simple force login without addons?

    resolved by google: http://buddypress.org/forums/topic/bbpress-force-login-for-buddypress

    'code'
    <?php
    /*
    Plugin Name: Force Login
    Description: No one can see your forums unless they are logged in.
    Plugin URI: http://bbpress.org/forums/topic/117
    Author: Michael D Adams *voodoo code from Trent Adams and Sam Bauers*
    Author URI: http://blogwaffe.com/
    Version: 0.8
    */

    function force_login_init() {
    if ( !bb_is_user_logged_in()
    && 0 !== strpos($_SERVER['REQUEST_URI'], bb_get_option( 'path' ) . 'bb-login.php')
    && 0 !== strpos($_SERVER['REQUEST_URI'], bb_get_option( 'path' ) . 'bb-reset-password.php')
    && 0 !== strpos($_SERVER['REQUEST_URI'], bb_get_option( 'path' ) . 'register.php')
    && 0 !== strpos($_SERVER['REQUEST_URI'], bb_get_option( 'path' ) . 'xmlrpc.php')

    ) {

    nocache_headers();
    header("HTTP/1.1 302 Moved Temporarily");
    bb_safe_redirect( bb_get_uri( 'bb-login.php', null, BB_URI_CONTEXT_HEADER + BB_URI_CONTEXT_BB_USER_FORMS ) );
    header("Status: 302 Moved Temporarily");
    exit();

    }
    }

    add_action( 'bb_init', 'force_login_init' );

    ?>
    '/code'

  2. Hooray! This actually worked for me. I'm on Bbpress 1.0.2! Thanks mate!

  3. Aha, It's so greats.

  4. You must log in to post.