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

1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
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.