I'm hoping someone here can help me, I want to add an extra field to the user profile called 'Job Title', which I've done by modifying wp-admin/profile.php and user-edit.php. I did it this way as I wanted to have the field in the 'About Me' section in the profile.
I then wrote a very basic plugin that updates the user meta data when the profile page is changed. It look like this:
add_action('personal_options_update', 'update_my_job_title');
add_action('edit_user_profile', 'update_job_title');
function update_my_job_title(){
global $current_user;
$job_title = $_POST['job_title'];
update_usermeta($current_user->id, job_title, $job_title);
}
function update_job_title(){
global $profileuser;
$job_title = $_POST['job_title'];
update_usermeta($profileuser->id, job_title, $job_title);
}
The reason there are two functions that appear to do the same thing is that I found out that updating your own profile and changing a users profile are two separate php files have different functions.
The problem I have is that update_my_job_title() works just fine and updates wp_usermeta as it should when the form is submitted - as I use the personal_options_update hook.
Unfortunately with update_job_title(), the function works but for the life of me I can't seem to find a hook for the form being submitted. The one I'm using, edit_user_options seems to happen when the user-edit.php is loaded.
Does anyone tell me what hook I need to use so that the user_meta is updated when the form is submitted?
I know this isn't particularly impressive function or solution, but it's the first one I've tried to write myself.
Any help would be greatly appreciated...
/ Hami