User login

Display a Drupal login form anywhere with PHP, including in page content

Searched words: 
show Drupal user login form display user registration form in page signup form custom placement

Update: I gave slightly incorrect code, I'm pretty sure swapping out 'user_register' to put in 'user_login' will work just fine:

dan hak 3:08
whats the code for the login block

benjamin melançon 3:09

<?php
global $user;
if (!
$user->uid) {
?>
<div class="user-register">
<?php
print drupal_get_form('user_register');
?>
</div>
<?php
} else {
?>
You are already logged in.  GO AWAY!
<?php
}
?>

I'm sending you *poetry* man
pouring my heart out
a little appreciation please

Resolution

Comments

user_login_block

Tim Yager:

i found that to correctly display the user login block you use
print drupal_get_form('user_login_block');

Thanks

hey!! thanks for the wonderful idea to use drupal's form.

Cheers!!!

user_pass form does not show any fields

I have a sign up link that contains a link for requesting a new password. If i go into admin and clear cached data and then logout and click on the request new password link the form shows correctly in the thickbox i am using. When I refresh the browser and try to click the link a gain the form does not show any fields. I am using Drupal 6. Any help would be appreciated

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Internal paths in single or double quotes, written as "internal:node/99", for example, are replaced with the appropriate absolute URL or path. Paths to files in single or double quotes, written as "files:somefile.ext", for example, are replaced with the appropriate URL that can be used to download the file.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.