How To Disable Drupal "Create New Account" Link or Tab If Using Profile2 Registration Path ?

how to disable create new account tab in drupal

The default Drupal login page at /user/login shows three tabs - Login, Create New Account and Request Password. Using the tabs, a visitor can either login, create a new account or request password. If visitors cannot create accounts on the Drupal website themselves, then the "Create new account" link or tab can be disabled easily from Drupal administration. But when using Profile2 and Profile2 Registration path, the Drupal default "user/register" path lies redundant. In this post, we shall see how to disable the "Create new account" tab from the default user login page.


How to disable the "Create new account" link or tab if not using Profile2?

If we are not using Profile2 module to create separate profiles, and if we do not want users to be creating accounts themselves on the website then the "Create new account" tab or link can be disabled easily from the following step:
  • Configuration > Account Settings > Registration and cancellation 
  • Under "Who can register accounts?", select "Administrators Only"
This will disable the "Create new account" link and only administrators can create new accounts if required.

How to disable the "Create new account" if using Profile2 and Profile2 Registration Path?
 
On one particular site, I have setup a separate profile called "Candidate" using Profile2 module and also setup separate registration path for the "Candidate" profile using "Profile2 Registration path" which is "/candidate/register". 
  • I want visitors to create account themselves via "candidate/register" path 
  • Using Profile2 Registration path module, candidates are assigned "candidate role"
  • I don't want visitor accessing the default "user/register" path
I goal is to let the candidates register via "/candidate/register" path only.  I am not expecting users to use the "user/register" link, which will be a regular Drupal account and not a "Candidate Account". So, the need to disable the "Create New Account" link or tab from the "user/login" page arises. The default login and request new password links may stay as that does not affect candidate login or password request.

Disabling the "Create new account" tab using Tab Tamer:
There are tips on Drupal.org to disable the "Create new account" using custom module. But if you do not want to write custom modules for this purpose, we can use the "Tab Tamer" module to disable or hide certain tabs. 

Tab Tamer is an administration utility that provides easy re-ordering, hiding, and deactivation of tabs and subtabs. You can also rename tab labels.

  • Download Tab Tamer module from Drupal.org 
  • Install the Tab Tamer module like you would install any other module at sites\all\modules"
  • Enable the module
  • Go to "/admin/config/system/tabtamer" and setup Tab Tamer to hide or disable tabs or link that are not required to be displayed
  • Tab Tamer displays most of the tabs you'd see in Drupal and each of them can be individually enabled, disabled or hidden.
  • To disable the "Create new account" tab, scroll down to till you see "User". Expand the item, and for the path "user/register", you can set it to:
    • hidden: "Create new account" tab is hidden but the path "user/register" is still active. So if user enters the path "user/register" manually, the create new account page will still appear.
    • disable: the "Create new account" tab is hidden as well as the path "user/register" disabled.
drupal-disable-create-new-account-tab-tamer-module
Tab Tamer Configuration Page

  • Save
  • Flush Cache
  • Test
After disabling the "user/register" path from "Tab Tamer" configuration page, the "Create new Account" tab is disabled and access to the path "user/register" is also blocked.


drupal-disable-create-new-account-tab


drupal-disable-create-new-account-tab-user-register

Candidates can still register account themselves from "candidate/register" path:

drupal-profile2-registration-path


Comment with Facebook

Comments

Related Posts Plugin for WordPress, Blogger...