Hi,

does anyone know how i can disable the 'request new password' link in the login box?

thanks,

Comments

ray_223’s picture

Public registration settings in "User Settings"

/admin/user/settings

Ray Smith
http://RaymondSmith.com

onejam’s picture

I have set it to 'Only site administrators can create new user accounts.' but this does not remove the request for a password link or the page.

thanks,

---------- Personal blog | tutorials | photography -----------
Freelance web designer/developer: duvien.com

-----------------------------------------------------------------
We build engaging websites and intuitive designs that will benefit your business.
Duvien

TKS’s picture

In your the CSS for your theme, try this:

#block-user-0 .item-list {
   display: none;
}

That should hide all the links under the login form, not just the password one -- but since you're not using the "Create New Account" option anyway...

onejam’s picture

Yes, that works fine, however if i go to url: /user, there is a tab which still has the 'request a password'. is there no way to completely disable this. Also how does one override forms in template on Drupal 6 so it can be custom styled on it's own. There seems to be ways to override search form and comment form but not login form?

---------- Personal blog | tutorials | photography -----------
Freelance web designer/developer: duvien.com

-----------------------------------------------------------------
We build engaging websites and intuitive designs that will benefit your business.
Duvien

TKS’s picture

Well, you could go into user.module and find/disable that bit of code, but hacking core is a really bad practice.

And in theory, you should be able to override that function in either your theme or a custom module. That's real coding, though, and definitely out of my depth -- sorry...

onejam’s picture

Thanks, i know, i don't like working with forms in Drupal. It's never an easy tasks. Something Drupal should really look into. But having said that it's complicated even for PHP developers to make it easy for themers to style any forms.

-----------------------------------------------------------------
We build engaging websites and intuitive designs that will benefit your business.
Duvien

Francewhoa’s picture

The following module is able to do that http://drupal.org/project/noreqnewpass

Loving back your Drupal community result in multiple benefits for you  
featherbelly’s picture

As this comes up so high in the search results I thought I would add this snippet... This will hide all the links in the User Login block.

Add something like the following to template.php (or a custom module):

function YOURTHEME_form_alter(&$form, &$form_state, $form_id) {
  
  // Comment out the following 4 lines on production - useful for seeing form build array.
  print( $form_id );
  echo('<pre>');
  print_r($form);
  echo('</pre>');
  
  switch($form_id){

    case 'user_login_block':
      unset($form['links']);
      break;

  }
}

View the print_r output to see the form build - you can add additional cases to the switch statement to alter other forms.

See here hook_form_alter and here Forms API Reference.

dams_26’s picture

An other solution is to put this in your page.tpl.php just before the render($tabs) line. Works fine on Drupal 7 :

if(isset($tabs['#primary'][1]['#link']['path']) && $tabs['#primary'][1]['#link']['path'] == 'user/password'){
   hide($tabs['#primary'][1]);
}
nikhilpk’s picture

if(isset($tabs['#primary'][2]['#link']['path']) && $tabs['#primary'][2]['#link']['path'] == 'user/password'){
   hide($tabs['#primary'][2]);
}
deivamagalhaes’s picture

In case anyone is still looking for this:
https://www.drupal.org/node/2356655

fazeela’s picture

Does this feature is available in Drupal 7? I've tried everything in user settings page.. but could not give me a solution.

mranthony’s picture

This work for me in Drupal 7.
In your theme's template.php file, add:

// Hide the request new password tab
function yourTheme_menu_alter(&$callback)
{
   unset($callback['user/password']);
}

Replace: "yourTheme" with the name of your theme.

liezie_D’s picture

Please note that hiding the link is not sufficient. The page to change it will still be accessible.
Your better option is to use module NoReqNewPass as stated by Francewhoa

François Capon’s picture

By adding this RewriteRule in the .htaccess (Apache 2.4 for QSD) of the Drupal 8 root folder, all requests URL of password resetting are redirected to the login form:

RewriteRule ^user/password.* /user/login [QSD,L,R=302]

Dan_Rogers’s picture

If you don't need the full, configurable module, you may simply use:

function MODULE_menu_alter(&$items) {
$items['user/password']['access callback'] = FALSE;
}