BP_Activity_Activity::total_favorite_count( int $user_id )
Get favorite count for a given user.
Description
Parameters
- $user_id
-
(Required) The ID of the user whose favorites you're counting.
Return
(int) $value A count of the user's favorites.
Source
File: bp-activity/classes/class-bp-activity-activity.php
public static function total_favorite_count( $user_id ) { // Get activities from user meta. $favorite_activity_entries = bp_get_user_meta( $user_id, 'bp_favorite_activities', true ); if ( ! empty( $favorite_activity_entries ) ) { return count( $favorite_activity_entries ); } // No favorites. return 0; }
Changelog
Version | Description |
---|---|
BuddyPress 1.2.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.