Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Filter the Activity Stream to Status Updates ONLY – Not Working

  • @takinglife2themax

    Participant

    Wordpress 3.8.2
    Buddypress 2.0
    teamupmovement.com/ex-stream

    I’m using a heavily modified version of the Encounters Lite Child theme (I’ve added BuddyPress support). I copied the bp-legacy folder into my theme as instructed, but for some reason, the activity stream will not change.

    I’ve been able to theme every other part of buddypress, but not the activity stream. It seems like somehow the default BP files are overriding my theme’s files. I’m just trying to filter the activity stream to status updates ONLY, but whenever I change the activity loop or index files, they always stays the same.

    Am I missing something? Can anyone tell me the right method to use to filter the activity stream to show status updates ONLY?

Viewing 6 replies - 1 through 6 (of 6 total)
  • @danbp

    Participant

    Hi @takinglife2themax,

    activities are very much coupled with ajax. And js is intolerant with a lot of little things such as css or code errors.

    If you copied the whole bp-legacy/buddypress/ into your theme, it is like you had 2 bp install, or at least a core and two templateted BP. Even if child has priority in the template hierarchy, JS is not able to handle this such easily (more on BP Dev blog). So it is better to load only the needed legacy file to the child.

    Can you show the code you use to filter the activity (pastebin or github) ?

    @takinglife2themax

    Participant

    Hi @danbp,
    Thanks for helping me out with this. I’m not so worried about the css issue right now, I’m going to get that squared away after I can get this content filter to work. Do you think that I have to add my modified bp-legacy files to my parent theme as well?

    The only file that I’ve changed in the bp-legacy/buddypress/activity folder is activity-loop.php, and I only changed line 3 to the following:

    <?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ).'&object=status' ) ) : ?>

    @danbp

    Participant

    Do you think that I have to add my modified bp-legacy files to my parent theme as well?

    For sure. If you don’t, the next BP update will overide this folder. Golden rule: never touch/modify any of the original plugin files.
    Any change you make is to do in the child-theme, including the legacy files you added to it.

    Theme Compatibility & Template Files

    You could also revert back, and try this function ( add it to child-theme’s functions.php)

    function bpfr_filtering_activity( $retval ) {
    	// activities to filter on, comma separated
    	$retval['object'] = 'status';		
    		return $retval;
    	}	
    add_filter( 'bp_before_has_activities_parse_args', 'bpfr_filtering_activity' );

    Read here for more details.

    @takinglife2themax

    Participant

    Thanks a lot @danbp!

    The function you provided was EXACTLY what I needed. I appreciate the post you provided with additional info as well. Extremely helpful stuff.

    After I added the function I realized that my activity stream was not showing anything. Then, I figured out that the BuddyPress Activity Plus Plugin doesn’t register status updates. So, once I deactivated it, everything was working perfectly.

    Thanks again, you are a huge help!

    @takinglife2themax

    Participant

    Alright, I have an update.

    It turns out that BuddyPress Activity Plus was not to blame after all. For some reason, when I use $retval['object'] = 'status'; it only shows activity updates that I’ve just submitted. Once I refresh the page, the stream is empty again.

    So I changed the function you provided to try to get around this, and to be conditional to the home page of my eX-Stream site only:

    		function bpfr_filtering_activity( $retval ) {
    			global $blog_id;
    			
    			// activities to filter on, comma separated
    			if ( $blog_id == 13 && is_front_page() ) {
    				$retval['action'] = 'activity_update';
    			}
    			
    			return $retval;
    			}	
    		add_filter( 'bp_after_has_activities_parse_args', 'bpfr_filtering_activity' );

    @danbp

    Participant

    OK, well done ! 😉 I mark this topic as resoled and close it.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] Filter the Activity Stream to Status Updates ONLY – Not Working’ is closed to new replies.
Skip to toolbar