Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Check if user is logged in in 1.0.1


_ck_
Participant

@_ck_

bb_is_user_logged_in() is right there, still in 1.0.1

The problem is you are checking too early, right when the plugin loads which is too soon.

A user is not determined as logged in until bb_init happens. So you have to make a mini-plugin

add_action('bb_init','check_login');
function check_login() {
if(!preg_match("/bb-login.php/", $_SERVER["SCRIPT_NAME"]) && !bb_is_user_logged_in()) {
header("Location: " . $bb->uri . "bb-login.php");
die("Authorisation required.");
}
}

Skip to toolbar