bp_get_total_favorite_count_for_user( int $user_id )

Return the total favorite count for a specified user.

Description

Parameters

$user_id

(int) (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

	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

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.