Hide deactivated users from members loop
how can I hide deactivated users from the members loop?
I work on an Intranet site based on WordPress for my company. I use BuddyPress and the plugin Active Directory Integration for displaying our staff. If a staff member leaves the company he/she will be automatically deactivated in WordPress. That means that the checkbox “User deactivated” is checked in the user’s profile in the back end. But these users are still displayed in the members loop. How can I exclude users from the loop based on whether they are deactivated?
I already read this thread:
But this code doesn’t work (added directly after
<?php while ( bp_members() ) : bp_the_member(); ?>
$user = new WP_User( bp_get_member_user_id() );
if ( ($user->roles == 'blocked') ) continue;
- The topic ‘Hide deactivated users from members loop’ is closed to new replies.