Buddypress Activity Filter Dropdown

I am wanting to change the default setting for the dropdown on BuddyPress activity feed.
The dropdown defaults to –Everything– , I would like to have it default to activity.

All posts I find, are about changing the actual feed content in the activity-loop.php file. I have done this. But it does not affect the dropdown filter on the profile page.

Please suggest a way to make this change

    Nithin

    Hi dwhitlock,

    Hope you are doing good today.

    All posts I find, are about changing the actual feed content in the activity-loop.php file. I have done this. But it does not affect the dropdown filter on the profile page.

    I suppose you want to remove it from the members profile, then the file should be activity.php located under members folder file, and not activity-loop.php. You'll have to copy the following template from BuddyPress to your theme, so that you can override it. The path is as follows /wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/members/single/activity.php

    You'll have to copy the activity.php into your themes folder, ie /wp-content/themes/theme-folder/buddypress/members/single/activity.php, and remove/comment the following line in your file:

    <option value="-1"><?php _e( '— Everything —', 'buddypress' ); ?></option>

    The final activity.php template would be as follows:

    <?php
    /**
     * BuddyPress - Users Activity
     *
     * @package BuddyPress
     * @subpackage bp-legacy
     */
    
    ?>
    
    <div class="item-list-tabs no-ajax" id="subnav" role="navigation">
    	<ul>
    
    		<?php bp_get_options_nav(); ?>
    
    		<li id="activity-filter-select" class="last">
    			<label for="activity-filter-by"><?php _e( 'Show:', 'buddypress' ); ?></label>
    			<select id="activity-filter-by">
    
    				<?php bp_activity_show_filters(); ?>
    
    				<?php
    
    				/**
    				 * Fires inside the select input for member activity filter options.
    				 *
    				 * @since 1.2.0
    				 */
    				do_action( 'bp_member_activity_filter_options' ); ?>
    
    			</select>
    		</li>
    	</ul>
    </div><!-- .item-list-tabs -->
    
    <?php
    
    /**
     * Fires before the display of the member activity post form.
     *
     * @since 1.2.0
     */
    do_action( 'bp_before_member_activity_post_form' ); ?>
    
    <?php
    if ( is_user_logged_in() && bp_is_my_profile() && ( !bp_current_action() || bp_is_current_action( 'just-me' ) ) )
    	bp_get_template_part( 'activity/post-form' );
    
    /**
     * Fires after the display of the member activity post form.
     *
     * @since 1.2.0
     */
    do_action( 'bp_after_member_activity_post_form' );
    
    /**
     * Fires before the display of the member activities list.
     *
     * @since 1.2.0
     */
    do_action( 'bp_before_member_activity_content' ); ?>
    
    <div class="activity">
    
    	<?php bp_get_template_part( 'activity/activity-loop' ) ?>
    
    </div><!-- .activity -->
    
    <?php
    
    /**
     * Fires after the display of the member activities list.
     *
     * @since 1.2.0
     */
    do_action( 'bp_after_member_activity_content' ); ?>

    I hope this helps. Please let us know if you still need any further assistance. Have a nice day.

    Kind Regards,
    Nithin

    dwhitlock

    Ok, so a few things...

    1. I tried to make changes as you suggested above. I did not see any effect from the copy of the activity.php file when placed in the themes directory based on the path you detailed above.
    2. I did see a change when I edited the original file in the buddypress plugins folder.
    3. The change provided a partial fix to my issue... -Everything- was no longer the default in the dropdown. This is good! So now the default is Updates, but what is shown in the stream on the page is still the info for -Everything- . Only when I select a different filtering option in dropdown, then reselect Updates, do I see the correct info on the page.

    So why did the activity.php file in the themes folder not work? And how do I get the dropdown to filter to Updates in addition to default to the word Updates in the dropdown?

    Rupok

    Hi dwhitlock,

    Thanks for sending all these details. From your description, it seems like you want to make the "Updates" option default for that dropdown in all pages and for doing that, creating a MU Plugin will be the best option I think. For creating a MU Plugin, create a folder named "mu-plugins" inside your "wp-content" folder. Then inside that "mu-plugins" folder, create a file with any name and with a .php extension. Now paste the code inside that file and save.

    <?php
    add_action( 'wp_footer', 'change_default_filtering_01' );
    function change_default_filtering_01() {
        ?>
        <script type="text/javascript">
          jQuery(document).ready(function() {
    		jQuery("#activity-filter-by option[value='-1']").remove();
    		jQuery("#activity-filter-by option[value='activity_update']").attr("selected",true);
          });
        </script>
        <?php
    }

    For getting more idea on mu plugins, you can go through this article: http://premium.wpmudev.org/manuals/wpmu-manual-2/using-mu-plugins/

    Please let us know if you have any confusion or if it doesn't work exactly the way you want. We will be glad to help further.

    Have a nice day. Cheers!
    Rupok