bbp_current_user_can_access_create_topic_form

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

Description

bbp_current_user_can_access_create_topic_form(); 

Usage

  1. if ( !function_exists( 'bbp_current_user_can_access_create_topic_form' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/users/template.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bbp_current_user_can_access_create_topic_form(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/users/template.php  
  1. function bbp_current_user_can_access_create_topic_form() { 
  2.  
  3. // Users need to earn access 
  4. $retval = false; 
  5.  
  6. // Always allow keymasters 
  7. if ( bbp_is_user_keymaster() ) { 
  8. $retval = true; 
  9.  
  10. // Looking at a single forum & forum is open 
  11. } elseif ( ( bbp_is_single_forum() || is_page() || is_single() ) && bbp_is_forum_open() ) { 
  12.  
  13. // User can edit this topic 
  14. } elseif ( bbp_is_topic_edit() ) { 
  15. $retval = current_user_can( 'edit_topic', bbp_get_topic_id() ); 
  16.  
  17. // Allow access to be filtered 
  18. return (bool) apply_filters( 'bbp_current_user_can_access_create_topic_form', (bool) $retval );