Hide deactivated users from members loop
-
Hi,
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:
https://buddypress.org/support/topic/hide-members-from-members-directory/But this code doesn’t work (added directly after
bp_the_member()
in members-loop.php):<?php while ( bp_members() ) : bp_the_member(); ?>
<?php
$user = new WP_User( bp_get_member_user_id() );
if ( ($user->roles[0] == 'blocked') ) continue;
?>
- The topic ‘Hide deactivated users from members loop’ is closed to new replies.