bbp_current_user_can_access_create_topic_form()

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

Description

Return

(bool)

Source

File: bp-forums/users/template.php

2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
function bbp_current_user_can_access_create_topic_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 ( ( bbp_is_single_forum() || is_page() || is_single() ) && bbp_is_forum_open() ) {
        $retval = bbp_current_user_can_publish_topics();
 
    // User can edit this topic
    } elseif ( bbp_is_topic_edit() ) {
        $retval = current_user_can( 'edit_topic', bbp_get_topic_id() );
    }
 
    // Allow access to be filtered
    return (bool) apply_filters( 'bbp_current_user_can_access_create_topic_form', (bool) $retval );
}

Changelog

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