3

I am using 'Login Block' to access Intranet pages from our website. I used 'Login Block' on www.example.com/common-intra page to login into intranet section.

I am using userprotect module to hide profile/username/password information from the users when they logged in into Intranet section (www.example.com/common-intra) with universal account.

But, I wanted to hide/remove "Request New password" link from Intranet Login page:

I found this module, haven't used yet though:enter image description here https://www.drupal.org/project/noreqnewpass

Is there any other easy way to just hide "Request New password" link from that Intranet Login page?

I still want this tab on general login page such as: www.example.com/user But, I just want to hide it from the www.example.com/common-intra page.

I also tried to hide it with css.

This is my page source code:

<div class="panel-separator"></div><div class="panel-pane pane-block pane-user-login common-intra pane-user common_login_button" class="panel-pane pane-block pane-user-login common-intra pane-user common_login_button"> <div class="pane-content"> <form action="/common-login?destination=node/16" method="post" id="user-login-form" accept-charset="UTF-8"><div><div class="form-item form-type-textfield form-item-name"> <label for="edit-name">Username <span class="form-required" title="This field is required.">*</span></label> <input type="text" id="edit-name" name="name" value="" size="15" maxlength="60" class="form-text required" /> </div> <div class="form-item form-type-password form-item-pass"> <label for="edit-pass">Password <span class="form-required" title="This field is required.">*</span></label> <input type="password" id="edit-pass" name="pass" size="15" maxlength="128" class="form-text required" /> </div> <div class="item-list"> <ul> <li class="first last"><a href="/user/password" title="Request new password via e-mail.">Request new password</a></li> </ul></div> <input type="hidden" name="form_build_id" value="form-_xyzabc" /> 

<div class="form-actions form-wrapper" id="edit-actions"><input type="submit" id="edit-submit" name="op" value="Log in" class="form-submit" /></div></div></form> </div> </div> 

I gave class name 'common-intra' to user login block to my node template.

.common-intra ul li{ display: none; } 

I also tried:

.panel-pane pane-block pane-user-login common-intra pane-user common_login_button ul li { display: none; } 
1
  • finally, you got some advance? Commented Jan 27, 2016 at 6:06

3 Answers 3

4

this will remove it from the render array before it is printed. In your theme's template.php, add:

function MYTHEME_form_alter(&$form, &$form_state, $form_id) { if($form_id == 'user_login_block') { $form['links']['#markup'] = '<div class="item-list"><ul><li class="first"><a href="/dev/user/register" title="Create a new user account.">Create new account</a></li></ul></div>'; } } 

Basically, it is just rewriting the markup for the links in the user login block. You can tweak this to theme as well. this should only apply to the user block

2

You can use the No request new password module:

Remove "Request new password" link from block and user page.

I tested the module and it works fine.

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

<?php if(isset($tabs['#primary'][2]['#link']['path']) && $tabs['#primary'][2]['#link']['path'] == 'user/password'){ hide($tabs['#primary'][2]); } ?> 

You can find other solutions in:

Disabling 'Request new password' on Login block

How to remove menu tabs front login page?

2
  • Thanks. 'noreqnewpass' module is nice but it removes "request new password" link from all page even on www.example.com/user page too. I just want to remove "request new password" link from particular one page which is www.example.com/common-intra Commented May 7, 2015 at 19:39
  • @Vidushi try the code in my answer in your intranet.tpl page Commented May 7, 2015 at 19:42
1

As per API reference, in your custom module you can:

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

https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_menu_alter/7.x

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.