bbp_edit_user_forums_role

Output forum role selector (for user edit).

Description

bbp_edit_user_forums_role(); 

Usage

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

Defined (1)

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

/includes/users/template.php  
  1. function bbp_edit_user_forums_role() { 
  2.  
  3. // Return if no user is being edited 
  4. return; 
  5.  
  6. // Get the user's current forum role 
  7.  
  8. // Get the folum roles 
  9. $dynamic_roles = bbp_get_dynamic_roles(); 
  10.  
  11. // Only keymasters can set other keymasters 
  12. if ( ! bbp_is_user_keymaster() ) 
  13. unset( $dynamic_roles[ bbp_get_keymaster_role() ] ); ?> 
  14.  
  15. <select name="bbp-forums-role" id="bbp-forums-role"> 
  16. <option value=""><?php esc_html_e( '— No role for these forums —', bbpress ); ?></option> 
  17.  
  18. <?php foreach ( $dynamic_roles as $role => $details ) : ?> 
  19.  
  20. <option <?php selected( $user_role, $role ); ?> value="<?php echo esc_attr( $role ); ?>"><?php echo translate_user_role( $details['name'] ); ?></option> 
  21.  
  22. <?php endforeach; ?> 
  23.  
  24. </select> 
  25.  
  26. <?php