New
PeoplePress is here. Community building for WordPress, reimagined. Fast, modern, and built for the communities you've always wanted to run.
See it live

BuddyDev

Search

Replies

  • Keymaster
    (BuddyDev Team)
    Posts: 25509
    Brajesh Singh on in reply to: Featured Members #8615

    Hi Gregg,
    Thank you for posting.

    Something on the site is modifying the bp_has_members() loop. Are you using any plugin or code to filter on the members list somewhere?

  • Keymaster
    (BuddyDev Team)
    Posts: 25509

    Hi Tosin,

    Here is an example

    
    
    /**
     * Disable BuddyPress Components conditionally based on role.
     *
     * @param bool $enabled is component enabled?
     * @param string $component BuddyPress Component id(e.g 'activity', 'groups', 'notifications', 'friends', 'settings', 'xprofile', 'messages', etc)
     *
     * @return mixed
     */
    function buddydev_conditionally_disable_components( $enabled, $component ) {
    
    	if ( ! is_user_logged_in() )  {
    		return $enabled; // we do not disable component for the logged in user
    	}
    
    	$user = wp_get_current_user();
    
    	$roles = $user->roles ;
    	// $role check for 'subscriber', 'contributor',  'author', 'editor', 'administrator'
    
    	if ( 'friends' == $component && in_array( 'subscriber', $roles ) ) {
    		//disable friends for subscribers
    		$enabled = false;
    	}
    
    	return $enabled;
    }
    add_filter( 'bp_is_active', 'buddydev_conditionally_disable_components', 10, 2 );
    
    

    Submit

    Please feel free to modify and adapt it as per your requirements.

    Hope it helps.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25509

    You are most welcome!

  • Keymaster
    (BuddyDev Team)
    Posts: 25509
    Brajesh Singh on in reply to: BP Clear Notifications not working #8609

    Thank you Gregg. Our community will appreciate that.

  • Keymaster
    (BuddyDev Team)
    Posts: 25509

    Thank you for the appreciation Gregg.

    I am glad I was able to help 🙂

  • Keymaster
    (BuddyDev Team)
    Posts: 25509
    Brajesh Singh on in reply to: BP Clear Notifications not working #8604

    It is quiet possible. Please post the message with the error to them and they should be able to helps.

    It is related to access protection and something is triggering it on the server.

  • Keymaster
    (BuddyDev Team)
    Posts: 25509

    Hi Gregg,
    Thank you for the kind words and joining our premium membership.

    Here is the code that you can put in your bp-custom.php to skip the group

    
    
    /**
     * Skip a group from the group notifications.
     *
     * @param bool $skip true to skip notification.
     * @param BP_Activity_Activity $activity current activity instance.
     *
     * @return bool true to skip.
     */
    function buddydev_skip_group_from_notification( $skip, $activity ) {
    
    	$group_id = $activity->item_id;
    	//change the group id
    	if ( $group_id == 3 ) { //Please change '3' with your group id
    		$skip = true; //skip
    	}
    
    	return $skip;
    }
    add_filter( 'bp_local_group_notifier_skip_notification', 'buddydev_skip_group_from_notification', 10, 2 );
    
    

    Please change the group id with yours.

    Let me know if it works for you or not?

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25509
    Brajesh Singh on in reply to: BP Clear Notifications not working #8601

    Hi Gregg,
    Thank you for posting.
    if that is the error, it means your admin-ajax.php is not available due to access restrictions.

    Are you using any privacy plugin or some code to limit access to admin area?

  • Keymaster
    (BuddyDev Team)
    Posts: 25509

    Hi Tosin,
    about your last question.

    It is difficult to disable based on the member types as the member type is registered too late.

    Ravi & I looked at it and we found that we can disable the component conditionally but not using member type as context./ if using the user roles as context will work for you please let us know and we will post the code.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25509

    Posted a solution there.