Activity Default to My Friends

//Put this in your functions.php

function lmc_query_filter( $query_string ) {
$query_string .= '&scope=friends';
return $query_string;
}

//Change the loop in activity-loop.php
//Default to My Friends
if($_GET['friends'] == 'true'){
add_filter('bp_dtheme_ajax_querystring','lmc_query_filter');
} <?php if (bp_has_activities(lmc_activity_default())) : ?>

//Change the main activity link to include the 'friends=true' query string, in header.php
<li<?php if ( bp_is_page( BP_ACTIVITY_SLUG ) ) : ?> class="selected"<?php endif; ?>>
<a href="<?php echo site_url() ?>/<?php echo BP_ACTIVITY_SLUG ?>/?friends=true" title="<?php _e( 'Activity', 'buddypress' ) ?>"><?php _e( 'Activity', 'buddypress' ) ?></a>
</li>

4 Comments

You must be logged in to post a comment.


  1. Sorry, I have not tested this in a couple years. Perhaps the ajax query string system changed in 1.5, or the bp_dtheme_ajax_querystring hook no longer works.

    Sorry I am not more help, good luck


  2. Hi Adam - I think this is a great snippet. However, I'm trying to use it on Buddypress 1.5 and it doesnt seem to work. I'm using the Frisco theme (practically the same as bp default) - do you have any updates on this hack?
    Looking forward to hearing from you.

    Best,

    Mustafa


  3. This website is full of experimental code and meant to be for reference and learning. The technique above is running on 2 live websites that I have built for clients.

    The default buddypress themes 'Activity' link resides in header.php, this snippet adds a get value of friends=true which triggers the scope change in the query string.

    Like I said in the snippet, it has some bugs but by only hope is that it can be a stepping stone for building on the hack.


  4. idk where you get the idea of the header.php code, that goes in the "main-navigation.php"

    you should really look into your code a little more, none of these really do anything but fire off errors...

    Ron