1

I need to remove "Create new account" from the tabs on /user page.

I was suggested to use hook_menu, but:

Further: I've found that there is also hook_menu_alter hook. But it does not work for me also. I created the following function for testing:

function cleanetica_advanced_menu_alter(&$items) {
    $items['user'] = array(
       'title' => 'blogs',
       'description' => 'Listing of blogs.',
       #'page callback' => 'blog_page',
       'access arguments' => array('access content'),
       'type' => MENU_DEFAULT_LOCAL_TASK
     );
    //$items = array();
}

I see no changes in /user page after I have added this function into the module,

1
  • You are resetting the existing array!!! (and posting many questions for a single problem)
    – AKS
    Commented Feb 12, 2013 at 11:09

2 Answers 2

3

If you need the registration feature and you need to just remove the link from the default tab, then use menu_alter hook.

function modulename_menu_alter(&$item) {
// Hide the "Create new account" tab
$item['user/register']['type'] = MENU_CALLBACK;
}
2
  • This does not help. (Yes, I've cleaned the caches.)
    – porton
    Commented Feb 12, 2013 at 14:53
  • 1
    Well no, it works! I've just made a spelling error in PHP,
    – porton
    Commented Feb 12, 2013 at 14:55
1

I need to remove "Create new account" from the tabs on /user page.

Sounds like you just need to disable the ability for users to create their own account.

There's a config setting at:

Admin > Config > Account Settings "Who can register accounts" = "Administrators only"

Account settings

2
  • No, users should be able to create account from some other pages of the site
    – porton
    Commented Feb 12, 2013 at 11:10
  • 1
    You didn't state that in your question. Commented Feb 12, 2013 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.