bbp_current_user_can_access_create_forum_form()

Performs a series of checks to ensure the current user can create forums.

Description

Return

(bool)

Source

File: bp-forums/users/template.php

2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
function bbp_current_user_can_access_create_forum_form() {
 
    // Users need to earn access
    $retval = false;
 
    // Always allow keymasters
    if ( bbp_is_user_keymaster() ) {
        $retval = true;
 
    // Looking at a single forum & forum is open
    } elseif ( ( is_page() || is_single() ) && bbp_is_forum_open() ) {
        $retval = bbp_current_user_can_publish_forums();
 
    // User can edit this topic
    } elseif ( bbp_is_forum_edit() ) {
        $retval = current_user_can( 'edit_forum', bbp_get_forum_id() );
    }
 
    // Allow access to be filtered
    return (bool) apply_filters( 'bbp_current_user_can_access_create_forum_form', (bool) $retval );
}

Changelog

Changelog
Version Description
bbPress (r3549) 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.