Enable account status sorting in Member Directories in Ultimate Member

Enable account status sorting in Member Directories in Ultimate Member on child sites.

Snippet Type

Execute on Child Sites

Snippet

add_action("um_user_before_query","um_052422_orderby_profile_photo", 999999999, 2 );
function um_052422_orderby_profile_photo( $query_args, $obj ) {
   			
	$obj->query_args['meta_query'][ ] = array(
			'relation' => 'OR',
			'wxo_featured_clause' => array(
				'key' => 'account_status',
				'compare' => 'awaiting_admin_review'
			),
			array(
				"key" => 'account_status',
			),
			
	);

	$obj->query_args['orderby'] = array(
		'wxo_featured_clause' => 'DESC',
                'user_registered'     => 'DESC',
	); 
}