I want to add the login form to a custom page I've created using a custom module, but I dont know how?

Shouldn't there be a form to use like get_drupal_form?

Using Drupal 7.

2 Answers 2


Drupal comes with a login block you can put in any of your theme regions to have show up on that page.

Or you can use drupal_get_form('user_login') if you want it to show up in your content somewhere.

  • Using drupal_get_form('user_login') and it only returns "Array" ? Commented Oct 24, 2011 at 11:29
  • I had to do it like this: drupal_render(drupal_get_form('user_login')) Commented Oct 24, 2011 at 18:41

I figured it out. I used:

$html = drupal_render(drupal_get_form('user_login'))
return $html;

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.