The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

hooks for user-edit.php (4 posts)

  1. hami
    Posted 10 years ago #

    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

  2. Don't know how much it will help, but the "profile_update" action hook is invoked whenever a user's profile is updated (both yours or others). It's at the bottom of the wp_insert_user function in registration-functions.php.

  3. hami
    Posted 10 years ago #

    I tried it with changing the and add_action line to this:
    add_action('profile_update', 'update_job_title');

    Unfortunately it didn't seem to work. The data wasn't added to wp_usermeta when the profile was updated.

    There must be a way to do this as the Role Manager plugin must use some sort of hook when updating the profile, I just can't seem to find it.

    thanks for the suggestion though...

    / Hami

  4. hami
    Posted 10 years ago #


Topic Closed

This topic has been closed to new replies.

About this Topic