How to Hide Drupal's "Request New Password" Tab

Sometimes your site only has one or two users (like this site!), and you have no need for the built-in Drupal "Request new password" tab on the user login block. It's really quite easy to disable this tab. All you have to do is have a custom module, and implement hook_menu_alter.

If that sounds hard, it's not, I promise. The first couple sections of the module tutorial on will quickly get you started on your own module, and then all you have to do is implement hook_menu_alter like this...

function example_module_menu_alter(&$callback)

...and clear your menu cache (very easy if you are using the Administration Menu module). Just don't forget to replace "example_module" with your module name! Now the tab will be gone, and if someone tries to navigate to "user/password," they will get a 404 Page Not Found error.



Looking at the api

Looking at the api ( it would suggest you use:

function MYMODULE_menu_alter(&$items) {
// Example - disable the page at node/add
$items['user/password']['access callback'] = FALSE;

Drupal 6 vs. Drupal 7

Thanks for the feedback. You are correct, that is the way to do it in Drupal 7. My approach works for Drupal 6.


This worked for D7 - saved me a lot of time and works great! Thanks!


This worked for me! The tip about Drupal 7 was correct!

form id?

Would be nice if the example had an if statement to check the form_id before performing the hide operation - handy for folks who do custom things with other forms and don't want that particular operation on those.

good point

You are correct, the code example I listed above is a very generalized example. Thanks for the feedback!

form id is user_pass

the form id is user_pass I believe.

See also this question/answer for related information that might be of help:

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

This question is for testing whether you are a human visitor and to prevent automated spam submissions.