BuddyDev

Search

Replies

  • Participant
    Level: Guru
    Posts: 900
    Tosin on in reply to: Display sitewide activity for followers only #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: Guru
    Posts: 900
    Tosin on in reply to: Display sitewide activity for followers only #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

  • Participant
    Level: Guru
    Posts: 900
    Tosin on in reply to: Display sitewide activity for followers only #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: 900
    Tosin on in reply to: Display sitewide activity for followers only #14444

    Hello Brajesh,

    The stated code did not work it was this code stated below that worked

     /**
     * 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' ); 

    and I also applied the second code like this

     <?php if( ! is_user_logged_in() ) :?>
    		
    			<?php do_action( 'bp_before_activity_type_tab_all' ); ?>
    
    			<li class="selected" id="activity-all"><a href="<?php bp_activity_directory_permalink(); ?>" title="<?php esc_attr_e( 'The public activity for everyone on this site.', 'klein' ); ?>"><?php printf( __( 'All Members <span>%s</span>', 'klein' ), bp_get_total_member_count() ); ?></a></li>
    
    			<?php endif;?> 
  • Participant
    Level: Guru
    Posts: 900
    Tosin on in reply to: Buddypress Force follow 5 members after registration #14434

    Hello Brajesh,

    I think we can count friendship request sent by the logged in user but the count should be limited to 3 friendship request and the error message can be (Connect with 3 new friends to continue)

    Regards
    Tosin

  • Participant
    Level: Guru
    Posts: 900
    Tosin on in reply to: Display sitewide activity for followers only #14417

    Hello Brajesh,

    I got it to work by editing the /buddypress/activity/index.php and removing the (all members) code. I later copied the edited file into my theme and applied the code stated below, now all logged in users are automatically viewing activities of people their following.

     /**
     * Filter sitewide activity to list following user's activity.
     *
     * @param array $args args.
     *
     * @return array
     */
    function buddydev_custom_list_activities_filter( $args ) {
    	if ( ! is_user_logged_in() || ! bp_is_members_directory() ) {
    		return $args;
    	}
    
    	// for logged in user, change scope to following.
    	$args['scope'] = 'follow';
    
    	return $args;
    }
    
    add_filter( 'bp_after_has_activities_parse_args', 'buddydev_custom_list_activities_filter' ); 

    The only bad effect is that it removed (all members) tab for logged out user, so I was forced to block access to site wide activity page for logged out users.

    Thank you

  • Participant
    Level: Guru
    Posts: 900
    Tosin on in reply to: Buddypress Force follow 5 members after registration #14416

    Hello,

    Mr Brajesh your code worked sucessfully. Thank you very very much i’m really grateful. Infact you just made this Nigerian boy very happy God bless you.

    I was wondering if this code can be replicated for FRIENDSHIP connections if possible, please share this code in your blog for other users to benefit.

    This code will foster better connections on buddypress sites

    You are simply the best, God bless.

  • Participant
    Level: Guru
    Posts: 900
    Tosin on in reply to: Display sitewide activity for followers only #14393

    I also changed my theme to wordpress tweenty fourteen theme and the problem still occurs.

  • Participant
    Level: Guru
    Posts: 900
    Tosin on in reply to: Display sitewide activity for followers only #14389

    I applied the stated code but no changes. Activities are still changing automatically from (following) to (all members) upon clicking on staus update form

  • Participant
    Level: Guru
    Posts: 900
    Tosin on in reply to: Display sitewide activity for followers only #14387

    I also tried this code you provided and I got the same result which is the filter keeps changing back to (all members) when I click on the status update form(what’s new form)

    /**
     * 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' );