Print or render Drupal user account profile form anywhere

Code below allows you to render the Drupal user edit form anywhere. Replace UID with the user account ID to edit.

$account = user_load(UID);
module_load_include('inc', 'user', 'user.pages');
$form_state = array();
$form_state['build_info']['args'] = array($account);
form_load_include($form_state, 'inc', 'user', 'user.pages');
print render(drupal_build_form('user_profile_form', $form_state));

4 comments for 'Print or render Drupal user account profile form anywhere'

yakoub's picture

you should call drupal_get_form and not drupal_build_form
no need for form_load_include

David's picture

I found the entire Software Tailor team to very helpful and knowledgeable. You help me understand the differences between the other systems on the market and the Software Tailor system.
Ruan Jian Wai Bao

Joma's picture

how can you tell me what is that? Actually it makes me confuse