bp_get_mentioned_user_display_name

Returns the mentioned user display name.

Description

(string) bp_get_mentioned_user_display_name( (bool) $user_id_or_username = false ); 

Returns (string)

The mentioned user's display name.

Parameters (1)

0. $user_id_or_username — Optional. (bool) => false
The user id or username.

Usage

  1. if ( !function_exists( 'bp_get_mentioned_user_display_name' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-activity/bp-activity-template.php'; 
  3.  
  4. // The user id or username. 
  5. $user_id_or_username = false; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_get_mentioned_user_display_name($user_id_or_username); 
  9.  

Defined (1)

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

/bp-activity/bp-activity-template.php  
  1. function bp_get_mentioned_user_display_name( $user_id_or_username = false ) { 
  2.  
  3. // Get user display name. 
  4. $name = bp_core_get_user_displayname( $user_id_or_username ); 
  5.  
  6. // If user somehow has no name, return this really lame string. 
  7. if ( empty( $name ) ) { 
  8. $name = __( 'a user', buddypress ); 
  9.  
  10. /** 
  11. * Filters the mentioned user display name. 
  12. * @since 1.2.0 
  13. * @param string $name Display name for the mentioned user. 
  14. * @param int|string $user_id_or_username User ID or username use for query. 
  15. */ 
  16. return apply_filters( 'bp_get_mentioned_user_display_name', $name, $user_id_or_username );