Alter login form in block by id I have a small problem on D7, I need to alter the login form inside block (add class to inputs, placeholder and submit button text, custom pass reset and login links) im using hook_form_FORM_ID_alter. I don't need to use custom module.

block id = block-user-login, form id = user_login_block

My theme.php code

function themename_form_user_login_block_alter(&amp;$form, &amp;$form_state) {

    $form['name']['#attributes']['placeholder'] = t( 'Username' );
    $form['pass']['#attributes']['placeholder'] = t( 'Password' );

   // custom register link
    $form['actions']['signup'] = array(
        '#markup' =&gt; l(t('Register'), 'user/register', array(
            'attributes' =&gt; array(
                'class' =&gt; 'top-user-block-link register',
                'title' =&gt; t('Create a new user account.')
            )
        )),
    );

    // custom reset password link
    $form['actions']['request_password'] = array(
        '#markup' =&gt; l(t('Forgot my password'), 'user/password', array(
            'attributes' =&gt; array(
                'class' =&gt; 'top-user-block-link new-password',
                'title' =&gt; t('Request new password.'),
            )
        )),
    );
}


Links for password reset and login links renders fine, but i can't make the placeholders or class add to work.

i've tried to use 

function theme_form_alter(&amp;$form, &amp;$form_state, $form_id){
  if ($form_id === 'user_login_block') {
$form['name']['#attributes']['placeholder'] = t( 'Username' );
    $form['pass']['#attributes']['placeholder'] = t( 'Password' );
  }
}


but i works only on /login page.
If I recall correctly, you need $form['account']['name']['#attributes'].