bp_get_total_favorite_count_for_user( int $user_id )

Return the total favorite count for a specified user.


Description Description


Parameters Parameters

$user_id

(Required) ID of user being queried. Default: displayed user ID.


Top ↑

Return Return

(int) The total favorite count for the specified user.


Top ↑

Source 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 1.2.0
		 * @since 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 );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.