BuddyDev

Search

Replies

  • Participant
    Level: Guru
    Posts: 811

    Hello Brajesh,

    Thank you so very much i’m very grateful. You even took the plugin a step further.

  • Participant
    Level: Guru
    Posts: 811
    Tosin on in reply to: BuddyPress Clear Notifications support for Klein theme #14824
    This reply has been marked as private.
  • Participant
    Level: Guru
    Posts: 811

    The code worked successfully thank you very much Brajesh, God bless.

  • Participant
    Level: Guru
    Posts: 811
    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: 811
    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: 811
    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: 811
    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: 811
    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: 811
    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: 811
    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.