BuddyDev

Search

Display sitewide activity for followers only

  • Participant
    Level: Guru
    Posts: 741
    Tosin on #14445

    How can I make this code show all members for logged out users

     /**
     * Set default activity directory tab for BuddyPress
     */
    function buddydev_set_default_activity_directory_tab() {
        // If user is not logged in or
        // If the scope is already set, do not do anything ok.
        if ( ! is_user_logged_in() || isset( $_COOKIE['bp-activity-scope'] ) ) {
            return ;
        }
        // additional check for activity dir
        if ( ! bp_is_activity_directory() ) {
            return ;
        }
        $tab = 'following'; // 'all', 'friends', 'groups', 'mentions'
        // Set scope to our needed tab,
        // In this case, I am setting to the 'friends' tab
        setcookie( 'bp-activity-scope', $tab,null, '/' );
        $_COOKIE['bp-activity-scope'] = $tab;
    }
    add_action( 'bp_template_redirect', 'buddydev_set_default_activity_directory_tab' ); 

    I will now be able to apply the two codes in my bp-custom.php file, one code for logged in users(this will show activities of people i’m following) while the other code is for logged out users (this will show activities of all members).

    Thank you

  • Participant
    Level: Guru
    Posts: 741
    Tosin on #14446

    Hello Brajesh,

    I think I have a better solution, how can i enable the (Facebook Like User Activity Stream for BuddyPress plugin) to work on the site wide activities page for logged in users since this will also pick activities of users i’m following.

    I have version 1.1.7 installed

    Thank you for your patience

  • Keymaster
    (BuddyDev Team)
    Posts: 22213
    Brajesh Singh on #14455

    Hi Tosin,
    At the moment, The FB Like User Activity Stream does not work on sitewide activity. Please allow me a week to release an update for the FB Like Activity Stream to support sitewide stream.

    Regards
    Brajesh

  • Participant
    Level: Guru
    Posts: 741
    Tosin on #14489

    Thank you Brajesh I will be looking forward to the update. But please note that the default activity should be set to (my wall or stream tab) for the logged in users and not (all members tab) while the default activity for logged out users should be set to (all members tab)

    Thank you very much, have a great day.

  • Participant
    Level: Initiated
    Posts: 11
    velli on #17343

    Hi
    This snippets works very well, but how can i set the default tabs to “All members” for new users who already has no friends? Right now it says “There are no activites” 🙁

    Regards
    Velli

  • Keymaster
    (BuddyDev Team)
    Posts: 22213
    Brajesh Singh on #17358

    Hi Velli,

    You can change the code to this

    
    
    // additional check for activity dir
    if ( ! bp_is_activity_directory() ) {
    	return ;
    }
    
    

    to

    
    
    	// additional check for activity dir
    	if ( ! bp_is_activity_directory() || friends_get_friend_count_for_user( get_current_user_id() ) < 1 ) {
    		return ;
    	}
    
    

    I am assuming you were using it for friends and not followers.

    PS:- For anyone else looking at this topic, The Facebook Like Activity Stream support sitewide activity now.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved