PT_CV_Values user_list
-
Hello,
the function user_list of PT_CV_Values retrieve all users, including subscribers. It should get authors, editors and administrators only (with a filter for custom roles).
Furthermore, user_login is not in the result.Proposition :
$result=array();
$show = ‘display_name’;
$roles = array(‘administrator’,’editor’,’author’);
$roles = apply_filters(PT_CV_PREFIX_.’author_roles’,$roles);
$args = array(
‘fields’ => array( ‘ID’, ‘user_login’, $show ),
‘orderby’ => ‘display_name’,
‘order’ => ‘ASC’,
‘role__in’ => $roles
);$users = get_users( $args );
foreach ( (array) $users as $user ) {
$user->ID = (int) $user->ID;
$display = !empty( $user->$show ) ? $user->$show : ‘(‘ . $user->user_login . ‘)’;$result[ $user->ID ] = esc_html( $display );
}
- The topic ‘PT_CV_Values user_list’ is closed to new replies.