Skip to:

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

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

Activity Heartbeat doesn't work for custom non-components scopes

Reported by: slaffik's profile slaFFik Owned by:
Milestone: Priority: normal
Severity: major Version:
Component: Activity Keywords:


Related to #5687

Heartbeat checks the overall latest activity, not in the current scope. It doesn't send scope so I can't filter properly what I need.

Change History (7)

#1 @imath
10 years ago

  • Keywords reporter-feedback added

I'm sorry, slaFFik, but as activity HeartBeat is using bp_ajax_querystring( 'activity' ) to set his arguments, then, the scope is carried. From the test i've made on #5688, if i var_dump the ajax querystring i have the scope argument.

Moreover, you can filter the argument of Activity Heartbeat using the 'bp_before_activity_latest_args_parse_args' filter.

As i've said in #5688 i'd be curious to see how you succeed in displaying activities from your custom scope into a tab of the activity directory.

#2 @slaFFik
10 years ago

  • Keywords reporter-feedback removed

Replied in #5687

#3 @imath
10 years ago

Yes thanks, i think it's actually working and i suspect a plugin filtering the bp_ajax_querystring before the priority you use to reset the scope reason why it's not arriving to heartbeat filter.

This is the test i've made, on activity directory, i go on the "My Groups" scope. I'm user_id 1, user_id 2 has created a group after me, so after going on My Groups, if i add the following hooks, and wait 15s

function slaffik_li() {
    // scope is js parsed to what is after "activity-" in the LI id. 
	<li id="activity-slaffik"><a href="#" title="testing">Slaffik</a></li>
add_action( 'bp_activity_type_tabs', 'slaffik_li' );

function slaffik_qs( $qs, $object ) {
	if ( 'activity' != $object ) {
		return $qs;

	$qs = wp_parse_args( $qs, array() );
	$qs['user_id'] = 2;

	return $qs;
add_filter( 'bp_ajax_querystring', 'slaffik_qs', 99, 2 );

function slaffik_dump_scope( $hb_args ) {
	$hb_args = wp_parse_args( $hb_args, array() );

	// Dumping args
	var_dump( $hb_args );

	return $hb_args;
add_filter( 'bp_after_activity_latest_args_parse_args', 'slaffik_dump_scope', 10, 1 );

this is what i get :

array(3) {
  string(19) "2014-06-01 15:20:46"
  string(6) "groups"

So the scope is once again catched, which is logic as the heartbeat filter is using bp_ajax_querystring( 'activity' ) to be sure to load the newest activities from the active scope.

So IMO something must be wrong before your 99 priority, a theme or a plugin ?

#4 @slaFFik
10 years ago

But are you on a slaffik custom tab?
You created it but in scope you have groups.

#5 @imath
10 years ago

I really think there's no difference at all :) but this is what i got on the slaffik tab

array(3) {
  string(19) "2014-06-01 21:12:01"
  string(7) "slaffik"

So the scope is catched.

#6 follow-up: @slaFFik
10 years ago

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

You are right, this issue can be closed.

Thank you for investigation and sorry for the time spent by you.

#7 in reply to: ↑ 6 @imath
10 years ago

Replying to slaFFik:

Thank you for investigation and sorry for the time spent by you.

you're welcome ;) glad you've found the origin of the issue.

Note: See TracTickets for help on using tickets.