Hide the "Create a new account" tab when lacking a registration code
zostay - May 4, 2007 - 22:09
| Project: | Invite |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
When the site is set to allow new accounts by invitation only, the Create new account tab shows up if a user clicks on the Request a New Password link.
It would be nice to remove the Create a new account tab unless they hit the page directly. It's kind of confusing to some folks and I'd rather not waste my time on this kind of support. ;)
I don't know how possible this actually is (I'll look into it and submit a patch if I can), but we may be resorting to just using CSS to hide it that way if nothing else.

#1
Hi Andrew,
the problem is that the menu entry is generated in the user.module whenever variable_get('user_register') returns not 0 (aka whenever User settings->Public registrations is not set to "Only site administrators..."). There is no way around that without patching the user.module. So i guess the invite.module cannot solve your issue.
However you could add the following lines to your template.php file(s):
function phptemplate_menu_item_link($item, $link_item) {if ($item['title'] == t('Create new account') && $item['path'] == 'user/register') return;
return l($item['title'], $link_item['path'], !empty($item['description']) ? array('title' => $item['description']) : array(), isset($item['query']) ? $item['query'] : NULL);
}
This prevents the "Create new account" menu item from being rendered.
#2
Thanks!
I'll try the work-around.
#3
This workaround worked, thanks a lot!
#4
Added knseibert's snippet to the (slightly outdated *ahem*) README.txt.
--
Stefan Kudwien
unleashed mind
#5
#6
I need this to work in version 6.x
can someone help me?