bbp_forum_enforce_blocked()

Check if a user is blocked, or cannot spectate the forums.

Description

Source

File: bp-forums/users/functions.php

1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
function bbp_forum_enforce_blocked() {
 
    // Bail if not logged in or keymaster
    if ( ! is_user_logged_in() || bbp_is_user_keymaster() ) {
        return;
    }
 
    // Set 404 if in Forums and user cannot spectate
    if ( is_bbpress() && ! current_user_can( 'spectate' ) ) {
        bbp_set_404();
    }
}

Changelog

Changelog
Version Description
bbPress (r2996) Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.