Hi all - I have searched the forums high and low, but cannot seem to find anything that does exactly what I need. I am making a drupal site in which there will only be one user - thus I want to remove the tab in the user_login form which says "request new password" - on the login page before the user logs in.
I would prefer to have this set up through a mini-module, not hacking the core or doing anything I don't really understand enough of to start with (yet, at the least).

I added "lodingmod"-folder to my /contrib/-folder, and made files loginmod.info and loginmod.module.

However, this is as far as I get for now, as my knowledge to php is somewhat limited, I really am at a loss now. How in the world can I get this to check the actual text string of the tab and then have it completely removed if, ie, equals "request new password".

I am very thankful for any pointers on this, I did find some really interesting information, did the mini-module that makes the login-form collapsible and that worked fine, though - it is not what I need.

Now, have fun and happy programming to all of you guys who know so much more about this than me.

FYI: I just recently started my grand Drupal-journey (after 10 years in web development - mainly asp/vbscript/sql-builds), and am having so much fun with this so far. Am looking forward to be part of this great environment, and hopefully can be a contributor to help out others in the future :-)

A.S.

Comments

dwees’s picture

The login block is a form, so I would take a look and see if you can find the function 'user_block' in the user.module core file.

It probably have a line like 'drupal_get_form' which is a call to a special builder function that creates the user login block.

What you want to do is examine this function and override it (I believe you can override such functions using a theme override function) or if the links are included in the form itself, you can use a hook_form_alter in your module and check to see if the $form_id matches the user form.

Dave

asaaheim’s picture

Hmm - somehow, kind of by accident, I dumped into http://drupal.org/node/68792

I set this all up in my file loginmod.module, part of it follows (only slight language edits done to the code):

* Implementation of hook_form_alter().
*/
function _phptemplate_variables($hook, $vars = array()) {

  if($hook == 'page') {
    fjerntab('be om nytt passord', $vars);
    // Legg til flere linjer her dersom flere tabs på innloggingssiden skal gjernes.
  }

  return $vars;
}

function fjerntab($label, &$vars) {
  $tabs = explode("\n", $vars['tabs']);
  $vars['tabs'] = '';

  foreach($tabs as $tab) {
    if(strpos($tab, '>' . $label . '<') === FALSE) {
      $vars['tabs'] .= $tab . "\n";
    }
  }
}

It seems to work perfectly.
This is more than sufficient for my need, as it is ONLY within the login-form that I needed to "get rid of" the tab.

Now - how do I delete posts in the forum that I posted before? Pls? So I can tidy up my own mess...

THANKS a lot for your swift reply Dave!

-Still lots to learn.

A.S.