Replies
- Tosin on April 13, 2018 at 10:33 am 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;?>
- Tosin on April 12, 2018 at 9:07 pm 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 - Tosin on April 12, 2018 at 11:16 am 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
- Tosin on April 12, 2018 at 10:48 am 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.
I also changed my theme to wordpress tweenty fourteen theme and the problem still occurs.
- Tosin on April 10, 2018 at 12:49 pm 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
- Tosin on April 10, 2018 at 10:54 am 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' );
- Tosin on April 10, 2018 at 10:35 am in reply to: Display sitewide activity for followers only #14385
Hello
Thank you for the code, I am using the latest update of buddypress follow from gith hub. I applied your code and it worked successfully but I noticed a problem which was when I logged into the site wide activities page the activities being displayed were that of users im following, but when I wanted to post a status update by clicking on status update form the activity tab filter automatically changed back to (all members) without clicking on the all members tab.
I would like to disable the (all members) tab totally, if possible to remove it.
- Tosin on April 14, 2017 at 4:48 pm in reply to: [Resolved] Remove add friend button for member type on members page/members loop #8597
Ok this will work, all I have to do is create a new custom user role and automatically assign the role with the necessary member types. So when a new user registers as either a brand or business his role will automatically be registered as the custom role. You can paste the code.
Thank you very much for your help I really appreciate your effort.
- Tosin on April 11, 2017 at 12:58 pm in reply to: [Resolved] Remove add friend button for member type on members page/members loop #8565
Ok thanks
Alternatively, what about removeing the friend tab in the navigation menu and drop down menu for one or more specific member types. This should solve the problem