I'm using our Microsoft Active Directory server to authenticate users on our Drupal site. All user and password management will be handled in AD. Therefore, the 'Request new password' link at the bottom of the User Login block really doesn't need to be there. Is there any way to disable this, or modify the block so that it doesn't include the link?

Thanks,

Robert Aldridge

Comments

BamaRob’s picture

I found a solution (I usually do immediately after posting to a public forum :-) )...

What I did:

I edited modules/user/user.module and commented out three of lines of code:

Line 501: $items[] = l(t('Request new password'), 'user/password', array('title' => t('Request new password via e-mail.')));

Line 712: $items[] = array('path' => 'user/password', 'title' => t('Request new password'),
Line 713: 'callback' => 'drupal_get_form', 'callback arguments' => array('user_pass'), 'access' => !$user->uid, 'type' => MENU_LOCAL_TASK);

Is this the best way to do this? It works. So, I'll stick with it unless someone has a better way.

Thanks,

Robert Aldridge

gpk’s picture

If you'd rather not hack core you could:

- create your own custom block based on the one in user.module
- override the user/password menu entry so that it is not accessible (i.e. set 'access' to FALSE) or set callback to 'drupal_not_found'. You can do this in mymodule_menu(), e.g.:

if (!may_cache) {
  $items[] = array(
    'path' => 'user/password',
    'title' => 'Menu item disabled', // The 'title' key is required
    'callback' => 'drupal_not_found',
    'type' => MENU_CALLBACK
  )
}

This works because menu items in modules' !may_cache sections get added after all the cacheable ones (see Pro Drupal Development book p. 45).

gpk
----
www.alexoria.co.uk

BTG308’s picture

Have a look at this: http://drupal.org/node/115159#comment-196079

Worked for me (Drupal 5.2).

/ Richie

BamaRob’s picture

The more I learn, the more I like about Drupal.

Thanks,

BR