Yes we can do it using function hook_form_alter(&$form, &$form_state, $form_id) {}
Just include this function in template.php of your theme or in you module.
If you theme name is "testtheme" then replace hook with you theme name(testtheme).
OR
you can include it in your custom module. If you have custom module with name "testmod" then just add this code in your module and replace the hook with your module name (testmod)
function **hook**_custom_form_alter(&$form, $form_state, $form_id){
//Get the users from database or keep it static according to requirement
$users = array("user1"=>"User 1","user2"=>"User 2","user3"=>"User 3");
if($form_id=="user_login"){
$form['name']['#type'] = "select";
$form['name']['#options'] = $users;
$form['name']['#required'] = true;
$form['name']['#size']='auto';
}
}
Don't forget to clear drupal cache.
Hope it will help!
user_id
once selected? I mean, why do you want to change the realuser_login
form to show a select list of specific users ...