I want to create a basic page that has only one of my custom user account fields listed, and available to edit.
For example, I have a custom user account field: field_companyname
Rather then directing the user to go to
I want the user to go to a different page (i.e
On this page, there should only be a single text input field, and a submit button to save the new data to the user account.
I'm pretty sure I need to implement
user_save(), but I just don't know where to go from here.
// load user object $existingUser = user_load('USERID'); // update some user property $existingUser->some_property = 'foo'; // save existing user user_save((object) array('uid' => $existingUser->uid), (array) $existingUser);
Any help or pointers would be much appreciated. Thanks for looking!
EDIT: I was able to load the entire user account edit form onto a node using the following code:
<?php module_load_include('pages.inc', 'user', 'user'); global $user; $account = user_load($user->uid); $output = drupal_render(drupal_get_form('user_profile_form', $account)); return $output; ?>
However, I still cannot figure out how to display ONLY my single custom field. Any help is greatly appreciated.
EDIT #2: I used CSS to hide the other fields that I did not want to display. Seems like there should be a better way to do this. But I guess this will work for now, unless anyone else can chime in :-)
Thanks again for looking.