bbp_current_user_can_access_create_forum_form

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

Description

bbp_current_user_can_access_create_forum_form(); 

Usage

  1. if ( !function_exists( 'bbp_current_user_can_access_create_forum_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_forum_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_forum_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 ( ( is_page() || is_single() ) && bbp_is_forum_open() ) { 
  12.  
  13. // User can edit this topic 
  14. } elseif ( bbp_is_forum_edit() ) { 
  15. $retval = current_user_can( 'edit_forum', bbp_get_forum_id() ); 
  16.  
  17. // Allow access to be filtered 
  18. return (bool) apply_filters( 'bbp_current_user_can_access_create_forum_form', (bool) $retval );