get_users

get_users

 $wp_users = get_users( array( 'fields' => array( 'ID') ) );

 if( is_array($wp_users) ) {
     $wp_userlist = array(
         'keine Angabe' => ''
     );

 foreach($wp_users as $user_id){
     if(empty(get_user_meta ( $user_id->ID)['first_name'][0]) or empty(get_user_meta ( $user_id->ID)['last_name'][0])) {
         $wp_userlist[get_user_meta ( $user_id->ID)['nickname'][0]] = $user_id->ID;
     } else {
         $wp_userlist[get_user_meta ( $user_id->ID)['first_name'][0] . ' '. get_user_meta ( $user_id->ID)['last_name'][0]] = $user_id->ID;
     }
}

 

Share this post

Share on facebook
Share on twitter
Share on pinterest
Share on email