filter activity loop
-
How do activity only display updates from new topics and replies?
-
Your question is a bit unclear: only display updates from new topics and replies
BP jargon:
Updates are messages you add on site wide activity, group or profile activity (what’s new form)New topics are (normaly) related to bbPress forum topics.
And replies can came from, in fact, everywhere. Blog post comments & replies
Ativity comments & replies
Forum comments & replies…Give details please or use one of those methods: template modification or custom function.
Templating
Function
Hi danbp.
The objective is display in a custom loop of activities only forum threads.Try:
function angelo_filter_activity( $retval ) { $retval['scope'] = 'bbp_reply_create,bbp_topic_create'; return $retval; } add_filter( 'bp_after_has_activities_parse_args', 'angelo_filter_activity' );
Hi shanebp.
Not work for me, how to add the filter here:if ( bp_has_activities( bp_ajax_querystring( 'activity' ) ) ) :
Thanks.
You should paste @shanebp’s code into your theme’s functions.php file. That’s where it should go.
Hi Henry Wright.
I pasted in functions.php
=/
This is my custom loop:<?php do_action( 'bp_before_activity_loop' ); ?> <?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ) ) ) : ?> <noscript> <div class="pagination"> <div class="pag-count"><?php bp_activity_pagination_count(); ?></div> <div class="pagination-links"><?php bp_activity_pagination_links(); ?></div> </div> </noscript> <?php if ( empty( $_POST['page'] ) ) : ?> <ul id="activity-stream" class="activity-list item-list"> <?php endif; ?> <?php while ( bp_activities() ) : bp_the_activity(); ?> <?php locate_template( array( 'activity/entry.php' ), true, false ); ?> <?php endwhile; ?> <?php if ( bp_activity_has_more_items() ) : ?> <li class="load-more"> <a href="#more"><?php _e( 'Load More', 'buddypress' ); ?></a> </li> <?php endif; ?> <?php if ( empty( $_POST['page'] ) ) : ?> </ul> <?php endif; ?> <?php else : ?> <div id="message" class="info"> <p><?php _e( 'Sorry, there was no activity found. Please try a different filter.', 'buddypress' ); ?></p> </div> <?php endif; ?> <?php do_action( 'bp_after_activity_loop' ); ?> <form action="" name="activity-loop-form" id="activity-loop-form" method="post"> <?php wp_nonce_field( 'activity_filter', '_wpnonce_activity_filter' ); ?> </form>
Works fine with a little change:
function omni_filter_activity( $retval ) { $retval['action'] = 'bbp_reply_create,bbp_topic_create'; // change scope per action return $retval; } add_filter( 'bp_after_has_activities_parse_args', 'omni_filter_activity' );
- The topic ‘filter activity loop’ is closed to new replies.