Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drupal render login form programmatically

I'm trying to display the login form in a basic page. When I'm logged in, this redirects me to the user account page. When I'm logged out, this shows nothing.

<?php drupal_get_form("user_login"); ?>
like image 549
Don Sevcik Avatar asked Aug 16 '12 21:08

Don Sevcik


1 Answers

Solved!

For D7:

<?php 
$elements = drupal_get_form("user_login"); 
$form = drupal_render($elements);
echo $form;
?>

For D6:

<?php 
echo drupal_get_form("user_login");
?>
like image 144
Don Sevcik Avatar answered Oct 02 '22 09:10

Don Sevcik