[buddypress-trac] [BuddyPress Trac] #3794: Deleted activity items remain favourited
buddypress-trac
noreply at wordpress.org
Sun Sep 28 13:12:33 UTC 2014
#3794: Deleted activity items remain favourited
--------------------------+--------------------
Reporter: ewebber | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 2.2
Component: Activity | Version: 1.5.1
Severity: normal | Resolution:
Keywords: has-patch |
--------------------------+--------------------
Comment (by imath):
Replying to [comment:13 DJPaul]:
Thanks Paul for your feedback.
> Why do we want to change that away from storing the total count in user
meta? User meta seems the appropriate place for this (just like how we
already store an activity's total favourite count in its `favorite_count`
activity meta).
Well so far user metas are used to store the activity item ids that has
been favorited (not the count). So when an activity item is deleted, its
idea is still in the usermeta and the count( usermeta ) is wrong.
I have no objection to store a count in user meta, it's just the count is
already there by requesting activities having the type 'activity_favorite'
for the user id.
>
> If I wanted to find out the user IDs (for example) of everyone who has
favourited a specific activity item, how would I do that? To clarify, I am
not necessarily saying we should build new API functions to do this, I am
just wondering how it would be possible to do this.
Well i think you can do something like this :
{{{
$activity_id = 34;
$user_activities = bp_activity_get( array(
'filter' => array(
'action' => 'activity_favorite',
'item_id' => $activity_id,
),
'show_hidden' => true,
'per_page' => false,
) );
$user_ids = wp_list_pluck( $user_activities['activities'], 'user_id' );
}}}
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3794#comment:14>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list