Drupal – Render Forgot Password Form by drupal_get_form()

Update @ 2013-05-30: The piece of code in this post works on Drupal 6. If you are looking for Drupal 7 solution, please refer to the comment made by Matthias. Thanks Matthias. =D

If you want to print the Forgot Password form with drupal_get_form(), you have to include the user module.
Try the following piece of code.

<?php
  // Drupal Forgot Password Form
  module_load_include('inc', 'user', 'user.pages');
  print drupal_get_form('user_pass');
?>

 

Done =)

Reference: printing the ‘request-new-password’ form

Advertisements

5 thoughts on “Drupal – Render Forgot Password Form by drupal_get_form()”

  1. Thanks for the snippet!

    For D7 I had to use drupal_render to render the form:

    module_load_include('inc', 'user', 'user.pages');
    $pw = drupal_get_form('user_pass');
    print drupal_render($pw);
    

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s