bp_displayed_user_id

Get the ID of the currently displayed user.

Description

(int) bp_displayed_user_id(); 

Returns (int)

$id ID of the currently displayed user.


Usage

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

Defined (1)

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

/bp-core/bp-core-template.php  
  1. function bp_displayed_user_id() { 
  2. $bp =buddypress); 
  3. $id = !empty( $bp->displayed_user->id ) 
  4. ? $bp->displayed_user->id 
  5. : 0; 
  6.  
  7. /** 
  8. * Filters the ID of the currently displayed user. 
  9. * @since 1.0.0 
  10. * @param int $id ID of the currently displayed user. 
  11. */ 
  12. return (int) apply_filters( 'bp_displayed_user_id', $id );