How to avoid listing of unapproved members from the member listing?

Photo of author
Written By geekerhub

Lorem ipsum dolor sit amet consectetur pulvinar ligula augue quis venenatis. 

Ultimate Member plugin shows all the members on member listing page.

Depends on client requirements, sometimes developer need to remove the members from member listing page.

Here is the code snippet, that will help to avoid unapproved members from listing
Need to add this code snippet in functions.php file

/*
	Avoid listing of unapproved members from the listing
*/
function um_prepare_user_query_args_callback( $query, $directory_data ){
	$query['meta_query'][] = array(
		'key'       => 'um_member_directory_data',
		'value'     => 's:14:"account_status";s:8:"approved";',
		'compare'   => 'LIKE'
	);
	return $query;
}
add_filter( 'um_prepare_user_query_args', 'um_prepare_user_query_args_callback', 10, 2 );

Leave a Comment