bp_activity_total_favorites_for_user

Retrieve the number of favorite activity stream items a user has.

Description

(int) bp_activity_total_favorites_for_user( (int) $user_id = 0 ); 

Returns (int)

Total favorite count for the user.

Parameters (1)

0. $user_id — Optional. (int)
ID of the user whose favorite count is being requested.

Usage

  1. if ( !function_exists( 'bp_activity_total_favorites_for_user' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-activity/bp-activity-functions.php'; 
  3.  
  4. // ID of the user whose favorite count is being requested. 
  5. $user_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_activity_total_favorites_for_user($user_id); 
  9.  

Defined (1)

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

/bp-activity/bp-activity-functions.php  
  1. function bp_activity_total_favorites_for_user( $user_id = 0 ) { 
  2.  
  3. // Fallback on displayed user, and then logged in user. 
  4. if ( empty( $user_id ) ) { 
  5.  
  6. return BP_Activity_Activity::total_favorite_count( $user_id );