Hide user login

Last updated on
9 October 2016

In the default setup the Drupal login block is always displayed unless a user is logged in. This may not always be desirable. For example, if you are using Drupal to create a site that has a very small number of people actually logging into the system to create or edit content, then you probably don't want a large portion of your screen real-estate taken up with a login block that only serves a small minority of users. This also confuses the majority of your users that will not have the option to log in.

To disable the login block

  1. Go to the blocks administration page:
    • Drupal 6: Administration » Site building » Blocks
    • Drupal 7: Administration » Structure » Blocks
    • Drupal 8: Manage » Structure » Block layout
  2. In the Region column next to User login select None
  3. At the bottom of the page, click Save Blocks

Your regular content editors and administrators can still log in to the site by directly accessing the login page:

NOTE FOR DRUPAL 8: If you do not have any content on the front page and remove the default "Front Page" under configuration >> settings, the default content for the front page is the user page or the login form for users who are not logged in. This can not be removed through the block layout system. 

Selectively hide the login block

Since the login block is a normal block, you can configure it on the blocks administration page. Use the configure link next to each block and you will be given options to set the visibility of the block by page and by role.

Move the login page

Obscurity is not security, and it is essentially impossible to hide that a site runs Drupal. Still, it is possible to move the login page from /user to another path with the Rename Admin Paths module.