bp_activity_get_favorite_users_tooltip_string( $activity_id )

Get users for activity favorite tooltip

Description

Parameters

$activity_id

(Required)

Return

(string)

Source

File: bp-activity/bp-activity-functions.php

function bp_activity_get_favorite_users_tooltip_string( $activity_id ) {

	if ( ! bp_is_activity_like_active() ) {
		return false;
	}

	$current_user_id = get_current_user_id();
	$favorited_users = bp_activity_get_meta( $activity_id, 'bp_favorite_users', true );

	if ( ! empty( $favorited_users ) ) {
		$like_text       = bp_activity_get_favorite_users_string( $activity_id );
		$favorited_users = array_reduce( $favorited_users, function ( $carry, $user_id ) use ( $current_user_id, $like_text ) {
			if ( $user_id != $current_user_id ) {
				$user_data = get_userdata( $user_id );
				if ( strpos( $like_text, $user_data->display_name ) === false ) {
					$carry .= $user_data->display_name . '
';
				}
			}

			return $carry;
		} );
	}

	return $favorited_users;
}

Changelog

Changelog
Version Description
BuddyBoss 1.0.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.