I'm trying to send user edit page to the user profile page (/user), so I can get user profile informations and user edit form on the same page.
function hook_preprocess_user_profile(&$vars) {
global $user;
$account = user_load($user->uid);
$vars['form'] = drupal_get_form('user_profile_form', $account);
}
Then in user-profile.tpl.php I have the following :
<?php print drupal_render($form['field_user_address']); ?>
<?php // Print necessary validation fields and remove others
unset($form['field_user_society_id']);
unset($form['field_user_locations']);
unset($form['locale']);
unset($form['account']);
print drupal_render($form);
?>
It works well, I have my form, the datas are coming into it but when saving it, even if I get status message "Changes have been saved" actually no datas are saved.
I tried to put module_load_include('inc', 'user', 'user.pages');
in a hook_init() and in a form_alter, but no way to get the form datas saved.
Thanks for helping.
hook_url_inbound_alter
andhook_url_outbound_alter
for 'faking' front-end paths. It would allow you to serve the form under a different url. But I am not sure if it overrideshook_menu
. Otherwise you would have to usehook_menu_alter
to remove theuser
path, but then you will probably run into weird issues whereuser/login
anduser/logout
are no longer available.