I am using UltimateMember and I have the settings configured that admin must approve registered users first. I now want to display the approved users meta information like faculty, email, etc. in the theme. So in this page template I've the following block of code to get all registered users information :
<?php
$args = array(
'role' => 'contributor',
);
$users = get_users( $args );
foreach ( $users as $user ) {
echo '<span>' . esc_html( $user->user_email ) . '</span>';
echo '<span>' . esc_html( $user->faculty ) . '</span>';
echo '<span>' . esc_html( $user->graduation_year ) . '</span>';
}
The problem is, that my code block is displaying all registered users information weather it is approved by admin or not.
who
parameter instead of role. who - If set to 'authors', only authors (user level greater than 0) will be returned.