Skip to:

Opened 9 years ago

Closed 9 years ago

#6671 closed defect (bug) (no action required)

New hook request: Added activity item at end of bp_activity_add()

Reported by: henrywright's profile henry.wright Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.3.3
Component: Activity Keywords:


At the end of bp_activity_add() there's already a hook do_action( 'bp_activity_add', $r );. But $r doesn't give us the ID of the new activity item. Is it possible to add a new hook? Something like this maybe?

	 * Fires at the end of the execution of adding a new activity item.
	 * @since x.x.x
	 * @param object $activity The activity item just added.
	do_action( 'bp_activity_add_obj', $activity );

I could use the various bp_groups_posted_update, bp_activity_comment_posted and bp_activity_posted_update hooks to get the ID but doing everything in one place via bp_activity_add_obj will make things easier.

Change History (2)

#1 @henry.wright
9 years ago

Alternatively, updating $r['id'] before the bp_activity_add hook would be good:

$r['id'] = $activity->id;

Last edited 9 years ago by henry.wright (previous) (diff)

#2 @henry.wright
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

This isn't really needed because I just found out bp_activity_after_save is available. I'm going to close this ticket. Thanks.

Note: See TracTickets for help on using tickets.