Created
May 25, 2019 10:07
-
-
Save Jerl92/39edbd31f512f357c4c297e99cdec2fe to your computer and use it in GitHub Desktop.
Show a selectable list of users
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $users = get_users( array( 'fields' => array( 'ID' ) ) ); | |
| $html[] .= "<select id='event-users' multiple>"; | |
| foreach($users as $user_id){ | |
| if ( get_current_user_id() != $user_id->ID ) { | |
| $data = get_user_meta ( $user_id->ID ); | |
| $html[] .= "<option value='$user_id->ID'>"; | |
| $html[] .= $user_id->ID; | |
| $html[] .= " - "; | |
| $html[] .= $data['first_name'][0]; | |
| $html[] .= " "; | |
| $html[] .= $data['last_name'][0]; | |
| $html[] .= "</option>"; | |
| } | |
| } | |
| $html[] .= "</select>"; | |
| $arr = implode("", $html); | |
| echo $arr; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment