• Resolved Lion73

    (@lion73)


    I need to write a function to load a list of users with a specific role and display the user’s first and last name.

    I have read the official documentation here about the feature Choices Callback Feature in UM 2.1+
    https://docs.ultimatemember.com/article/1539-choices-callback-feature-in-um-2-1
    This does not help me

    I need something like this but this doesn’t work

    function my_dropdown_list() {
    $args = array(
    ‘role’ => ‘MYROLE’
    );
    $users = get_users($args);
    if( empty($users) )
    return;
    echo'<select>’;
    foreach( $users as $user ){
    echo ‘<option value=”‘.$user->data->first_name.'”>’.$user->data->last_name.'</option>’;
    }
    echo'</select>’;
    }

    Someone can help me please?
    Regards
    Lion

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘List users by role in dropdown’ is closed to new replies.