I want to create a custom login and register page. I want both forms to show on the frontpage in the content area of my template above each other and not on separate nodes. Also, I would like to try to reuse the already existing code for validation of the forms.

I have looked around and found different ways to achieve this so I wonder what's the best way to do this..custom block, module or inside template or...?

Links to content or particular examples would be appreciated.

  • You could create them as blocks and places the blocks where you want.
    – antgiant
    Commented Mar 25, 2011 at 15:22

2 Answers 2




Will return the form for you and will deal with all the form stuff that needs to be dealt with. You just need to print whatever is returned by that function out and it should work.

Note: You did not specify the Drupal version, when using 7, drupal_get_form() returns an array which you need to pass through drupal_render() first to get a string that you can print.

  • Ok Thanks. do you recommend to use it in the theme or as a module?
    – grm
    Commented Mar 13, 2011 at 18:51
  • Depends. Maybe not directly in a template file, but you could implement a preprocess function, call it there and then just output the $variable in the template file. It can be in the theme though.
    – Berdir
    Commented Mar 13, 2011 at 18:58
  • Ok. Will give it a try. Btw: I found a module called LoginToboggan that has similar functionality. just for the record. Appreciate your help.
    – grm
    Commented Mar 13, 2011 at 19:08

Below are the name suggestions for tpl files used for user login, password reset, and user registration.

page-user-login.tpl.php page-user-password.tpl.php page-user-register.tpl.php

in the above you can use drupal_get_form('user_login'), drupal_get_form('user_pass'), drupal_get_form('user_register') to display the form.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.