Ajax Login module for Drupal

February 2nd, 2009

One of the design features for the new Developer Exchange site I’m working on was to allow the users to be able to login from anywhere on the site and not be forced to click through a number of pages to return to where they were previously. This would seem a simple enough proposition and easy to achieve with Ajax.

However, amazingly enough, despite the plethora of extension modules for Drupal there was nothing that simply turned the login process into a modal popup and performed the login via Ajax. Indeed, scanning the search results at the Drupal site showed that I was not the only person who was after this functionality and that it was in quite high demand.

Not to worry though! Drupal is amazingly extensible and very easy to work with, so I set about writing my own module to turn the login process into an Ajax modal dialog. Using the excellent jQuery Thickbox plugin and a smattering of Drupal hooks I was able to quickly put together what I needed. The results is the AjaxLogin module, which can be simply dropped into your Drupal installation and enabled via the Admin interface. When a user clicks on the login link, a modal popup is displayed as show in the picture below.

ajax-login

If you are interested in using the module, then you can download it from here until I am able to get a Drupal CVS account and contribute it to the project.

Warning

Using both the standalone Ajax Module and AjaxLogin at the same time will cause an infinite loop in the browser. Disable the login support in the Ajax module.