Hi

I want to modify the User Login block to remove the link Forgot Password?.

  1. Where does code and theme info for User Login block reside?
  2. Is using a template suggestion the best approach for disabling link Forgot Password??

I was reading about template suggestions here:

Thanks

Jeff in Seatle

Comments

kannan@kiluvai.com’s picture

Forgot Password is in the user_login_block form so using the form alter you can remove or customize the link forgot Password

function user_login_block() {
  $form = array(
    '#action' => url($_GET['q'], array('query' => drupal_get_destination())),
    '#id' => 'user-login-form',
    '#validate' => user_login_default_validators(),
    '#submit' => array('user_login_submit'),
  );
  $form['name'] = array('#type' => 'textfield',
    '#title' => t('Username'),
    '#maxlength' => USERNAME_MAX_LENGTH,
    '#size' => 15,
    '#required' => TRUE,
  );
  $form['pass'] = array('#type' => 'password',
    '#title' => t('Password'),
    '#maxlength' => 60,
    '#size' => 15,
    '#required' => TRUE,
  );
  $form['submit'] = array('#type' => 'submit',
    '#value' => t('Log in'),
  );
  $items = array();
  if (variable_get('user_register', 1)) {
    $items[] = l(t('Create new account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'))));
  }
  $items[] = l(t('Request new password'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.'))));
  $form['links'] = array('#value' => theme('item_list', $items));
  return $form;
}
josepvalls’s picture

I'm trying to do the same. I wrote a module to alter the form but nothing happens.

<?php
function mylogin_form_alter($form_id, &$form) {
switch ($form_id) {
case 'user_login_block':
unset($form['links']);
break;
}
}

I've red somewhere about module weights... Can it be that the links are being rendered after wards?

Anyway, I got it to work with these instructions for theming the box:

http://blogthingee.com/blog/login-little-liveler

timpiche’s picture

Their is a module for this functionality.

http://drupal.org/project/itweak_login

ayalsule’s picture