I want to remove the ability for a user to click "request new password" and also the H2 user login heading. It seems silly to me these are not options part of drupal already. How would I go about this all I've seen is coding examples and no template that can be overridden. I've searched modules but none of them that come up seem to have the functionality I'm looking for.

Oh I should mention I'm using the login in a block.

Thanks.

Comments

garethhallnz’s picture

Hi I have just been working on the same problem. I have away to remove the buttons

function mytheme_preprocess_page(&$variables) {
	$removeTabs = array(
		'user',
		'user/login',
		'user/register',
		'user/password',
	);
	$theTab = $variables['tabs']['#primary'];
	
	foreach($theTab as $val){	
		$i++;
		if(in_array($val['#link']['path'], $removeTabs)){
			$a = $i-1;
			$variables['tabs']['#primary'][$a] = '';
		}	
	}

}

Code should read like well written English

segana’s picture

Your solution worked for me prefectly...although I did have to add a '$i=0;' as $i was coming back as undefined.

It's taken me ages to find this solution as I'm currently building an Intranet, which uses the ldap module for authentication and account creation, but for it to work, the account creation settings have to be set to Visitor, which mean the tabs are visible on the login page, which we couldn't have.

All the solutions people post are simply to 'change the settings to admin'...no one seemed to understand that people might need to have that setting as visitor (although really the ldap module should be setup to create accounts regardless of the setting)

Thanks again though!!!! :)

rpeters’s picture

What code would I use if I want to display that they have input invalid username or password?

Yams’s picture

Hmm, I am also looking for a way to customize the login. I wanted to find a way to have a login with just the username and password entry with a submit button on the left and then my main links to the right. I've seen ideas for 6.x for customizing the logins (and now this), but could your solution work with a main menu as well?

Mr_Shah’s picture

for registration page example
(you need to install formblock module for this)

              $block = module_invoke('formblock', 'block_view', 'user_register');
              print render($block); 
    

if need to show login box anywhere
use :

              $block = module_invoke('user', 'block_view', 'login');
              print render($block); 
    

with css to hide other links

Mr_Shah’s picture

<style type="text/css">
<!--
#user-login-form .item-list {
display:none;
}