all links in drupal have 'on' and 'off' switch, except two links on the bottom of the 'log in' block
- one of them is 'create new account' and the other is 'request new password'

i'm seeking out help should someone know how to make them invisible

sincerely ed

Comments

glennr’s picture

Removing 'create new account', I assume you don't want anonymous users to be able to create a new account? If so, just go to admin > user settings and change the public registration setting to: "Only site administrators can create new user accounts".

To remove 'request new password', try one of the drupal.org search results. The first one listed looks promising.

optura’s picture

thanks a lot, works as intended with the 'create account' / the removal is dictated by my attempt to use drupal cores in place of organic groups without moderators/

the other link solved too /allowed myself to paste the gentleman's (Dave)code

create info file:

; $Id$
name = Loginmod
description = This module changes the default login block so it doesn't contain the 'request new password' field.
core = 6.x

call it: loginmod.info

next create 2nd file:

/**
* Implementation of hook_help().
*/
function loginmod_help($path, $arg) {
  switch ($path) {
    case 'admin/modules#description':
      return t('Makes login block collapsible');
  }
}

/**
* Implementation of hook_form_alter().
*/
function loginmod_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'user_login_block'){
       unset($form['links']);
       $items = array();
       if (variable_get('user_register', 1)) {
           $items[] = /* TODO
   Please manually fix the parameters on the l() or url() function on the next line.
   Typically, this was not changed because of a function call inside an array call like
   array('title' => t('View user profile.')).*/
l(t('Create new account'), 'user/register', array('title' => t('Create a new user account.')));
       }
       $form['links'] = array('#value' => theme('item_list', $items));
  }
}

call it:loginmod.module - place both in all/module/logmodule - it works as intended too

thanks once more, ed

fleshgrinder’s picture

Works like a charm!

The original function from the user.module for reference. You can alter the form as you like together with the above module.

function user_login_block() {
  $form = array(
    '#action' => url($_GET['q'], array('query' => drupal_get_destination())),
    '#id' => 'user-login-form',
    '#validate' => user_login_default_validators(),
    '#submit' => array('user_login_submit'),
  );
  $form['name'] = array('#type' => 'textfield',
    '#title' => t('Username'),
    '#maxlength' => USERNAME_MAX_LENGTH,
    '#size' => 15,
    '#required' => TRUE,
  );
  $form['pass'] = array('#type' => 'password',
    '#title' => t('Password'),
    '#maxlength' => 60,
    '#size' => 15,
    '#required' => TRUE,
  );
  $form['submit'] = array('#type' => 'submit',
    '#value' => t('Log in'),
  );
  $items = array();
  if (variable_get('user_register', 1)) {
    $items[] = l(t('Create new account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'))));
  }
  $items[] = l(t('Request new password'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.'))));
  $form['links'] = array('#value' => theme('item_list', $items));
  return $form;
}
Carnix’s picture

What about if I DO want users to be able to create their own accounts, but just not THIS way? The site I'm developing has alternative ways to create account via various actions, but we don't want users to create accounts without having done those actions. As in, no vanilla accounts. So, I want to remove the "create new account" link in that menu without using the admin setting that disables that ability site-wide. Thoughts?

EDIT: yes.. if a user knew to navigate to /user/register they could create an account -- but 98.9% of users won't think to do that, so I'm not too worried about the very slim savvy minority that know enough about sites do recognize Drupal and then force feed an account (this isn't for security reasons, its simply a requirement of the site that accounts be generated via participation, and simple registration isn't counted as participation)

j0e’s picture

in a custom module (in this example the module name is "custom"), you can simply paste the following snippet

<?php
function custom_form_alter(&$form, $form_state, $form_id) {
    if ($form_id == 'user_login_block') {
      $items[] = l(t('Request new password'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.'))));
      $form['links']['#value'] = theme('item_list', $items);
       }
}

you can also override the theming, but this should do it...

otherwise, use css

either visibility:hidden, or just display:none

Robgher’s picture

This is not recommendable because if the user knows a little about Drupal or is a little curious, he can open his browser's developer tools and uncheck the "display: none;", allowing him to use (click) it.

johan den hollander’s picture

I removed those links via this css code:

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

abinibi’s picture

Please where do I put the code?

I would like to remove " Create new account"

Thanks.

smartsystems160’s picture

This worked for me in bartik: Put the code somewhere in your theme's style.css file

#block-user-login .item-list li.first {
display:none;
}

If you want to remove same when the block is placed at the header region, use this code:

.region-header #block-user-login .item-list li.first {
display:none;
}

jabastin arul’s picture

Goto:

admin/config/people/accounts

under the "Registration and cancellation" please click the "Administrators only".

shifali baghel’s picture

It's worked.

Thanks Jabastin Arul 

somkir’s picture

how can i create custom url for my login