Alter the username label in the login block
Your code needs to go inside a custom module. Assuming your module is called lae then you just need to make one or two small changes to your code:

function lae_form_user_login_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  $form['name']['#title'] = t('User ID');
}


The edit- prefix that you get from the element's ID in HTML is actually provided by Drupal automatically, it's not the name of the key in the form array that identifies the element. Also the elements (at least for this particular form) will normally be at the root of the array so you don't want to reference $form['user-login-form']['edit-name'] (as it most likely doesn't exist).

I would advise downloading and installing the Devel module and using the dpm() function to print a nice representation of your form array to the screen, so that you can inspect it and see the correct array keys you'll need to target to effect a certain element.

// Add this to your form alter function:
dpm($form);