Hello Drupal Gurus!!!

How do you make create new account link accessible to one account only eg webmaster

Thanks

Comments

tm’s picture

you can set it in "user settings" (user management), that radio button at the top that says "Only site administrators can create new user accounts". it should disable the "create new account" link. don't forget to save configuration!

good luck!

John Rivera’s picture

This can be archived by going to "user settings" and turning "Only site administrators can create new user accounts." on. I tested and this option hides new account creation from front page.

ben_m’s picture

If you just want to hide the link but still allow users to create an account via some other means - say a civicrm contribution / membership profile then you can use hook_menu_local_tasks_alter() to remove the link from the tabs menu.

example code:

/**
 * Implementation of hook_menu_local_tasks_alter()
 */
function MODULENAME_menu_local_tasks_alter(&$data, $router_item, $root_path){
  if($router_item['path'] == 'user' && $root_path == 'user') {
    //watchdog('MODULENAME:',' <pre>' . print_r($data, true) . '</pre>');
    unset($data['tabs'][0]['output'][0]);
  }
}

domignon’s picture

You rock !

paulie007’s picture

Hi,

Where do I put this code exactly? I've added it to system.api.php, saved it, cleared cache but the create new account tab remains.
With Tab Tamer I can disable the link but not remove the tab. I'm using Drupal 7 and the Secure Login module (if that makes a difference)

Thanks,

Paulie

vm’s picture

in a custom .module

sjhuskey’s picture

This also works for removing all of the tabs from the login page. You can put it in a custom module or in a template: http://eureka.ykyuen.info/2011/01/31/drupal-remove-the-tabs-in-user-regi...

maxplus’s picture

Thanks, I have put the code in my template.php and it works fine!

robar’s picture

Many thanks for that snippet ben_m works a treat just include in the theme template file.

vm’s picture

should be in a custom.module

robar’s picture

Thanks, I'll change that. Reason against including in template file?