bp_get_total_favorite_count_for_user( int $user_id )
Return the total favorite count for a specified user.
Description
Parameters
- $user_id
-
(Required) ID of user being queried. Default: displayed user ID.
Return
(int) The total favorite count for the specified user.
Source
File: bp-activity/bp-activity-template.php
3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 | function bp_get_total_favorite_count_for_user( $user_id = 0 ) { $retval = false; if ( bp_activity_can_favorite() ) { // Default to displayed user if none is passed. $user_id = empty ( $user_id ) ? bp_displayed_user_id() : $user_id ; // Get user meta if user ID exists. if ( ! empty ( $user_id ) ) { $retval = bp_activity_total_favorites_for_user( $user_id ); } } /** * Filters the total favorite count for a user. * * @since BuddyPress 1.2.0 * @since BuddyPress 2.6.0 Added the `$user_id` parameter. * * @param int|bool $retval Total favorite count for a user. False on no favorites. * @param int $user_id ID of the queried user. */ return apply_filters( 'bp_get_total_favorite_count_for_user' , $retval , $user_id ); } |
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.