0

on my front page the user registers by typing in his username, email, password..once he clicks submit he log ins and is redirected to his profile edit page (not account settings)..i am able to do that using rules..i am using Profile2 and adding new fields..however i also want the old fields such as username, password,and email id to appear there ... it would be the same password or username and email id that the user entered while registering but i just want to create/display these fields on this edit profile page for completeness.they may have the earlier entered values copied and the user may enter/edit it here again and be able to save (ofcourse he should get an error if he enters a new email id on that page)

what i want is something like this: https://i.sstatic.net/GvYaK.jpg

1 Answer 1

0

Well i think you could do a hook_form_alter and alter the edit page when they go there. You would need to do a user_load($user) to get the information and then alter the form with those values. The tricky part is the password is encrypted so that may be an issue.

Example of user load

global $user
$user_info = user_load($user);

Example of hook alter on profile page

function mymodule_form_user_profile_form_alter(&$form, &$form_state)
{
 //Code here
}

http://api.drupal.org/api/drupal/modules%21user%21user.module/function/user_load/7 http://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_form_alter/7

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.