Skip to:
Content

BuddyPress.org

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#4033 closed enhancement (wontfix)

adding action in bp_activity_get_specific

Reported by: sboisvert's profile sboisvert Owned by:
Milestone: Priority: normal
Severity: trivial Version:
Component: Activity Keywords:
Cc: sboisvert

Description

I'd like to know if its possible to add an action hook in
function bp_activity_get_specific( $args = )
in bp-activity-functions.php line 847 on current trunk.

The use case is to remove/add filters that play with the results so that they don't impact the query when getting a single result.

Getting it lower in with bp_activity_get_user_join_filter is a bit awckward since those are the hooks I want to remove.

Change History (3)

#1 @boonebgorges
13 years ago

  • Keywords reporter-feedback added

It's hard to imagine other real use cases for an action like this.

Can I suggest that you just hook your unhook function to the same hook, with a lower priority?

function bbg_remove_filters( $sql ) {
   remove_filter( 'bp_activity_get_user_join_filter', 'filter_to_remove' );
   return $sql;
}
add_filter( 'bp_activity_get_user_join_filter', 'bbg_remove_filters' );

This is not terribly elegant, but at least it doesn't require adding an otherwise not-very-useful action hook.

As for detecting whether it's a single request: you could check strpos( $sql, 'a.id IN' ). (In the future, I would like to pass all of the function arguments to the hook, but I kinda don't want to do that until they've been converted to an array. See #3797)

#2 @sboisvert
13 years ago

  • Keywords reporter-feedback removed
  • Resolution set to wontfix
  • Status changed from new to closed

Yup, I think I can work with that.
Thanks!

#3 @DJPaul
13 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.