Own profile and administrator profile are listed in the members directory
-
Hi there, when I block a user, my own profile and administrator profile are listed in the members directory.
I am using this code to exclude logged and admin users from BuddyPress users list which is not working with the plugin activated:
function buddydev_exclude_logged_and_admin_users( $args ) { //do not exclude in admin if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { return $args; } $excluded = isset( $args['exclude'] ) ? $args['exclude'] : array(); if ( ! is_array( $excluded ) ) { $excluded = explode( ',', $excluded ); } $role = 'administrator';//change to the role to be excluded $user_ids = get_users( array( 'role' => $role, 'fields' => 'ID' ) ); $excluded = array_merge( $excluded, $user_ids ); if ( is_user_logged_in() ) { array_push( $excluded, get_current_user_id() ); } $args['exclude'] = $excluded; return $args; } add_filter( 'bp_after_has_members_parse_args', 'buddydev_exclude_logged_and_admin_users' );
How do solve this issue?
Best
Carsten
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Own profile and administrator profile are listed in the members directory’ is closed to new replies.