[buddypress-trac] [BuddyPress Trac] #7988: Supply new activity id to bp_activity_add action hook

buddypress-trac noreply at wordpress.org
Thu Oct 11 17:00:48 UTC 2018


#7988: Supply new activity id to bp_activity_add action hook
-------------------------+-----------------------------
 Reporter:  drywallbmb   |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Core         |    Version:  3.0.0
 Severity:  normal       |   Keywords:
-------------------------+-----------------------------
 The `bp_activity_add` action fired at
 https://buddypress.trac.wordpress.org/browser/tags/3.2.0/src/bp-activity
 /bp-activity-functions.php#L1925 will only supply the ID of the just-added
 activity if that ID was present when the function was called — which is to
 say, it's only present if an activity is actually being edited, not added.

 Not knowing the ID of the just-added activity severely limits the utility
 of this action.

 Example use case: I want to add certain `meta` value to activities as
 they're added. Hooking into `bp_activity_add` seems like the right (and
 possibly only) place to watch for these additions, but when activities are
 added I need to then call other code to actually fetch the ID of the
 activity in question in order to give it a meta value. This code is
 cumbersome to write and results in an unnecessary performance hit as I
 need to query the DB to get an ID that could otherwise just be provided to
 me.... the action provides all other useful and relevant information about
 the new activity, just not its id.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7988>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list