Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Activity stream – show personal activity


  • leanneoleary
    Participant

    @leanneoleary

    Hi,
    I cannot find anywhere in the documentation on how to only show personal activity items. By default the activity streams lists site wide activity and also have options to list Friends, Groups, mentions and Favourites by Ajax but doesn’t have an option to list just your personal items.

    I therefore added a link in a similar format to the others hoping this would load them but it doesn’t.

    <li id="activity-me"> <a id="just-me" href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() ?>">Personal</a>

    ie. http://mywebsite.com/members/myname/activity

    Can anyone advise on how this is done?

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

  • shanebp
    Moderator

    @shanebp

    You want to add a ‘Personal’ option to the ‘Show’ selector on Site Wide Activity?

    Try this in your theme/functions.php or in bp-custom.php

    function leanne_activity_filter_options() {
        if ( is_user_logged_in() )
             echo '<option value="personal">Personal</option>';
    }
    add_action( 'bp_activity_filter_options', 'leanne_activity_filter_options' );
    
    function leanne_ajax_querystring( $query_string, $object ) {
    
    	if ( 'activity' != $object ) 
    		return $query_string;
    
    	if ( ! bp_is_activity_directory() ) 
    		return $query_string;
    
    	$query_args = wp_parse_args( $query_string, array() );
    
     	$page = $query_args['page'];
    
    	if( isset( $query_args['action'] ) && $query_args['action'] == 'personal' ) {
    	
    		$query_args = array();
    		$query_args['page'] = $page;
    		$query_args['user_id'] = bp_loggedin_user_id();
    		$query_string = http_build_query( $query_args );
    
    	}
    	
    	return $query_string;
    
    }
    add_filter( 'bp_ajax_querystring', 'leanne_ajax_querystring', 20, 2 );

    leanneoleary
    Participant

    @leanneoleary

    That’s great, thanks!

    Unfortunately the theme Im using has two sets of filters; one set of filters is listed across the top with ‘All Members’, ‘Friends’, ‘Favorites’, ‘mentions’. This is where I want to add ‘Personal’. Then there is another filter in the form of a drop down which has ‘new members’, ‘posts’, ‘comments’ etc which is where your code has placed the ‘personal’ filter option.

    This is the code I currently have in activity/index.php:
    <li id="activity-me"> <a id="just-me" href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() ?>">Personal</a>

    Is it easy to adjust the code above so that it uses the code you have supplied to add the correct ajax filter? Ive tried playing around with your code but had no joy getting it to work.

    Many thanks for your help.


    shanebp
    Moderator

    @shanebp

    This is separate from the function I supplied.
    Put it in activity/index.php
    <li id="activity-just-me"> <a id="just-me" href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/'; ?>">Personal</a></li>

    You can also insert the link without using a template overload by using the provided hook:
    do_action( 'bp_activity_type_tabs' );


    leanneoleary
    Participant

    @leanneoleary

    Seriously? All I was missing was the ‘/’; ?

    Thanks so much for your help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Activity stream – show personal activity’ is closed to new replies.
Skip to toolbar