Drupal: Create A Custom Login Block

The other day Ron posted a comment on my post about how to make Drupal more secure with SSL logins asking for a bit more clarification on how to create a custom Drupal login block to redirect users to a secure (HTTPS) login page instead of the standard non-HTTPS Drupal login page.

Creating a custom Drupal login block is pretty simple. All you need to do is create a block (Admin|Build|Block) that has a few links to the HTTPS login page. To make it look more like the standard Drupal login block, you could add also links to the “forgot password” and “create new account” pages. And, just to be fancy, you could even add a nifty padlock PNG image. Once you create the block, enable it, then disable the standard Drupal login block so you don’t display both.

Here is the code I use in my login block which goes in the “block body” on the Block-build/configure page:

<img src="http://grownupgeek.com/padlck.png" alt="" align="right" /></code>
<li><a href="/user/login">Log In</a></li>
<li><a rel="nofollow" href="https://grownupgeek.com/user/register">Create Account</a><a></a></li>
<li><a rel="nofollow" href="https://grownupgeek.com/user/password">Forgot Password</a></li>
<small>For problems logging in email HELP@GrownUpGeek.com</small>

Which will give you a block that looks like this:
Custom Drupal Login Block


In addition to your custom login block, you could use a Drupal module like Fancy Login which will generate a cool looking javascript ‘lightbox’ type popup modal for the username and password.

Leave a Reply

Your email address will not be published.