I have created a module for user listing. when I edit any user then call drupal_get_form('user_register_form', $existing_account);, its not give me form with user data.
I used Profile2 module to add some custom filed in user registration page. Now in admin , I need those custom fields with user data in it. for that I used drupal_get_form('user_register_form', $existing_account); function where $existing_account = user_load($uid, $reset = TRUE);
function mymodule_create_subscriber() {
....
$existing_account = user_load($uid, $reset = TRUE);
.......
$extra =drupal_get_form('user_register_form', $existing_account);
$form = array_merge($form,$extra);
$form[actions]['submit'] = array(
'#type' => 'submit',
'#value' => t('Update Subscriber'),
'#weight' => 30
$form['#validate'][] = 'mymodule_create_subscriber_validate';
$form['#submit'][] = 'mymodule_create_subscriber_submit';
....
}
function mymodule_create_subscriber_validate(&$form, &$form_state) {
....some code
return;
}
function mymodule_create_subscriber_submit(&$form, &$form_state) {
$account = array();
$account = $form_state['values'];
......
$account = user_save($existing_account, $account, $category);
.....
}
Please help me where I am doing wrong or what should I do?