Opened 10 years ago
Closed 10 years ago
#6323 closed enhancement (fixed)
Unable to get user ID of activity items before they are deleted
Reported by: | johnjamesjacoby | Owned by: | |
---|---|---|---|
Milestone: | 2.3 | Priority: | high |
Severity: | normal | Version: | 1.1 |
Component: | Activity | Keywords: | |
Cc: |
Description
When deleting an activity stream item, it's not possible to get any relevant data about those items before they are deleted from the database.
Our existing implementation does pass the activity ID's themselves around, and calls to bp_activity_delete()
do have before & after actions for execution, but all those allow for is seeing what the query parameters are for the items being deleted, and they do not relay back anything about the actual items themselves.
What I'm trying to do:
- Keep a count of activity stream updates per user
- When an activity item is deleted, check the user ID and flush the cached count for the activity author
This is not currently possible because there is no way to intercept the deletion request, and the person deleting the activity might not be the same user that posted it, so the existing $user_id
checks do not help (and may tangentially be broken anyways.)
A few improvements to
BP_Activity_Activity::delete()
will fix this:*
instead ofid
wp_list_pluck()
the ID's out of the resultsdo_action_ref_array()
on the array of activity items about to be deletedBP_Activity_Activity::delete()
on all activity comments so this action is repeatedly fired correctlyextract()
call while we are in thereBP_Activity_Activity ::delete_activity_item_comments()
is not used. This method is from the olden days of Activity, before the mptt approach and when comments were part of the Wire component.