Search code examples
drupaldrupal-modulesdrupal-7drupal-theming

How to display one of Drupal's default forms


I have a module that I want to use to display a modified version of one of Drupal 7's default forms. I believe the form ID is user_profile_form and it is the form used to edit a user's account information.

So this is the structure of my module:

  1. hook_menu with a page callback to a function --> user_exe_edit() -->
  2. function user_exe_edit() calls drupal_get_form(input_simple_form) -->
  3. function input_simple_form($form, &$form_submit)

Now I need the function input_simple_form to return the Drupal form with id user_profile_form.

How do I do that?


Solution

  • You won't need your input_simple_form(), but you will need to include the user module's pages:

    global $user;
    // if the user is logged in, otherwise anonymous users will see it
    if ($user->uid > 0) {
       module_load_include('inc', 'user', 'user.pages');
       return user_edit($user);
    }