bp_get_loggedin_user_username

Get the username of the logged-in user.

Description

(string) bp_get_loggedin_user_username(); 

Returns (string)


Usage

  1. if ( !function_exists( 'bp_get_loggedin_user_username' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-members/bp-members-template.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_get_loggedin_user_username(); 
  7.  

Defined (1)

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

/bp-members/bp-members-template.php  
  1. function bp_get_loggedin_user_username() { 
  2. $bp =buddypress); 
  3.  
  4. if ( bp_loggedin_user_id() ) { 
  5. $username = bp_core_get_username( bp_loggedin_user_id(), $bp->loggedin_user->userdata->user_nicename, $bp->loggedin_user->userdata->user_login ); 
  6. } else { 
  7. $username = ''; 
  8.  
  9. /** 
  10. * Filters the username of the logged-in user. 
  11. * @since 1.2.0 
  12. * @param string $username Username of the logged-in user. 
  13. */