bbp_edit_user_display_name

Drop down for selecting the user's display name.

Description

bbp_edit_user_display_name(); 

Usage

  1. if ( !function_exists( 'bbp_edit_user_display_name' ) ) { 
  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_display_name(); 
  7.  

Defined (1)

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

/includes/users/template.php  
  1. function bbp_edit_user_display_name() { 
  2. $bbp =bbpress); 
  3. $public_display = array(); 
  4. $public_display['display_username'] = $bbp->displayed_user->user_login; 
  5.  
  6. if ( !empty( $bbp->displayed_user->nickname ) ) 
  7. $public_display['display_nickname'] = $bbp->displayed_user->nickname; 
  8.  
  9. if ( !empty( $bbp->displayed_user->first_name ) ) 
  10. $public_display['display_firstname'] = $bbp->displayed_user->first_name; 
  11.  
  12. if ( !empty( $bbp->displayed_user->last_name ) ) 
  13. $public_display['display_lastname'] = $bbp->displayed_user->last_name; 
  14.  
  15. if ( !empty( $bbp->displayed_user->first_name ) && !empty( $bbp->displayed_user->last_name ) ) { 
  16. $public_display['display_firstlast'] = $bbp->displayed_user->first_name . ' ' . $bbp->displayed_user->last_name; 
  17. $public_display['display_lastfirst'] = $bbp->displayed_user->last_name . ' ' . $bbp->displayed_user->first_name; 
  18.  
  19. if ( !in_array( $bbp->displayed_user->display_name, $public_display ) ) // Only add this if it isn't duplicated elsewhere 
  20. $public_display = array( 'display_displayname' => $bbp->displayed_user->display_name ) + $public_display; 
  21.  
  22. $public_display = array_map( 'trim', $public_display ); 
  23. $public_display = array_unique( $public_display ); ?> 
  24.  
  25. <select name="display_name" id="display_name"> 
  26.  
  27. <?php foreach ( $public_display as $id => $item ) : ?> 
  28.  
  29. <option id="<?php echo $id; ?>" value="<?php echo esc_attr( $item ); ?>"<?php selected( $bbp->displayed_user->display_name, $item ); ?>><?php echo $item; ?></option> 
  30.  
  31. <?php endforeach; ?> 
  32.  
  33. </select> 
  34.  
  35. <?php