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

6 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 comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.