[buddypress-trac] [BuddyPress Trac] #5688: Activity Heartbeat doesn't work for custom non-components scopes

buddypress-trac noreply at wordpress.org
Sat Jun 7 15:30:12 UTC 2014


#5688: Activity Heartbeat doesn't work for custom non-components scopes
--------------------------+------------------------------
 Reporter:  slaFFik       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Activity      |     Version:
 Severity:  major         |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by imath):

 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>
         <?php
 }
 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) {
   ["since"]=>
   string(19) "2014-06-01 15:20:46"
   ["scope"]=>
   string(6) "groups"
   ["user_id"]=>
   int(2)
 }
 }}}

 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 ?

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5688#comment:3>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list