Skip to:
Content
Pages
Categories
Search
Top
Bottom

Activity loop filtering – Multiple or excluding filter


  • divemasterza
    Participant

    @divemasterza

    Hi,

    The codex mention ‘&action=xxxxxxxxxx’ as a filter for the activity loop.

    <?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ) . '&action=activity_update' ) ) : ?>

    Is there anyway to exclude and activity type from the stream? Or if not, to have multiple appended filters.

    I hope my question makes sense 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

  • shanebp
    Moderator

    @shanebp

    You can use multiple filters with commas: &action=activity_update,new_blog_post

    See the comments here for other info:
    Using bp_parse_args() to filter BuddyPress template loops


    divemasterza
    Participant

    @divemasterza

    Thank you 🙂


    ruess
    Participant

    @ruess

    Super helpful and very hard to find. Just so we keep this archived (as the vital code is on a blog), I’m going to repeat it below:

    function my_bp_activities_include_activity_types( $retval ) {
        // only allow the following activity types to be shown
        $retval['action'] = array(
            'activity_update',
            'activity_comment',
            'new_blog_post',
            'new_blog_comment',
            'friendship_created',
            'created_group',
        );
     
        return $retval;
    }
    add_filter( 'bp_after_has_activities_parse_args', 'my_bp_activities_include_activity_types' );
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar