I would like to remove the "Create new account" link from the navigation menu and place it instead at the bottom of a sort of terms of use page instead. I would think this could be done in the menu customization page (/admin/build/menu-customize/navigation) but doesn't appear to be so. Any ideas without hacking the menu module?

**edit** It looks like I'd actually have to change the user.module. Regardless I really would rather avoid doing that.

Comments

blackarma’s picture

Works for me fine enought admin/build/menu-customize/navigation go to edit for Log out (i assume you are loged in ) And change Parent item to where you want to move it.

ddols’s picture

That removes the log out link for a logged in user. I want to remove the create new account link for a non-registered/logged in user, without disabling the ability for new users to create an account.

Creating the new link where I want it is easy. I just have to make a link to /user/register.

vm’s picture

log out
view the source code of the rendered page
copy the login block HTML

login
paste the HTML you copied to a new block
edit out what you don't want.

The confusion with the previous commentor was caused by you stating "navigation block" The login block and the navigation block are two different animals. The navigation block replaces the login block after loging in.

ddols’s picture

I never said anything about blocks. I said the navigation menu. The navigation menu does contain the "user login" block, but that is a core block/module, and like I said I would rather not hack it. Now I am a bit new to customizing Drupal modules, so I'm not sure if I can go about over-riding it. Anyway I want to leave the log in username and password fields, and the unrelated log out link (that's a different block altogether), as they are. I only want to remove the link to the create a new account page without disabling the ability for new users to create an account. I'll create a text link on a different page to /user/register.

vm’s picture

You're right my apologies.

For the record navigation menu is a block in a default drupal install as are all menus including but not limited to the primary menus. If it's a menu item it can be disabled in administer -> menus -> navigation and the user/register path is still usable, though you state you've already tried this and the offending menu item isn't listed. Default drupal install doesn't come with a "create new account" link in the nagation menu/block It's only in the login block. Therefore no idea how it's getting in your navigation menu unless its been thrown in at the theme layer in a custom tpl.php file for the theme in use.

ddols’s picture

But the login block changes every time you reload the page so I don't think that would work. For instance there are hidden input types with crazy long ID's and values that change every time the page is loaded, like <input type="hidden" name="form_build_id" id="form-c92a17e078d83c846f1fe040e91587eb" value="form-c92a17e078d83c846f1fe040e91587eb" />

I tried something like this last night trying to add a contact form to a page type node, but without the correct hidden input type it wouldn't actually send anything. I could past in the PHP function that the contact page uses, and it would work, but just pasting on the form elements wouldn't do anything when you clicked send.

vm’s picture

I've managed it using a copy and paste with login block on multiple occasions without any issues that I am aware of I've never tried to manipulate a contact form in the same way.

Rather then hacking user.module write a custom.moule based on the function in user.module and investigate employing hook_form_alter or if its a theme function you can override it at the theme layer in template.php

api.drupal.org

jaypan’s picture

To remove it from the register page, you can use hook_menu_alter, and set the URL to be of type MENU_CALLBACK.

Edit: you would have to write a module to do this.

Contact me to contract me for D7 -> D10/11 migrations.

vm’s picture

ahhh right forgot about that hook. Still find it odd the menu item is where the OP states it is but isn't listed as a menu item in the navigation menu itself.

piquef’s picture

I wanted to do exactly this and found an easy way without hacking anything:

1. Hide the User Login block by setting its region to <none> on the /admin/build/block page. This gets rid of the "Create new account" link. However it also gets rid of the Username/Password fields, so you have to provide a link to enable registered users to log in (see step 2).
2. Create a link somewhere on the front page for registered users to go to log in - the address of the login page is http://yoursite.com/?q=user
(You could make this a menu item in the Navigation menu or a link in a block on the front page.)
3. Create a link wherever you want it to allow unregistered users to create a new account. The address to link to is http://yoursite.com/user/register
4. The login link will, however, remain where you located it even after a user has logged in. If a logged in user clicks on it, it will display that user's account page.
NOTE: An alternative approach is to combine the 'login' and 'create new account' links in a single link, since the /?q=user page and the /user/register (see step 3) page provide for both needs: login and create new account.

Does this solve your problem?