Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to trigger hooks on member profile update?


  • vieiraadsv
    Participant

    @vieiraadsv

    Hi Folks,

    I would like to know how I could trigger any hook whenever the basic users ( subscribe level ) update their profiles.

    I’ve tried to use these ones:

    xprofile_updated_profile
    profile_data_after_save

    No success so far,the action has not been triggered.

    However, I’ve set up a hook on user signup named bp_complete_signup, and this one works perfectly.

    Thereby, how could reach out some hook on user profile update?

    Thanks in advance.

Viewing 4 replies - 1 through 4 (of 4 total)

  • vieiraadsv
    Participant

    @vieiraadsv

    I have solved the issue by myself. I think the action xprofile_updated_profile has worked all the time. It has a redirect after this action so I was not seeing its update, that was what happened. Follow my debug code below:

    function updateSubscribe( $user_id, $posted_field_ids, $errors, $old_values, $new_values ) 
    {
    	if ( empty( $errors ) ) 
            {
                echo "<pre>";
                //print_r( $posted_field_ids ); 
                echo "<br>user id: " . $user_id . "<br>";
                echo "<b>Old values</b><br>";
                print_r($old_values);
                echo "<b>New values</b><br>";
                print_r($new_values);
                echo "</pre>";
    	}
            die("END");
    }
    add_action('xprofile_updated_profile', 'updateSubscribe', 1, 5);
    

    Henry Wright
    Moderator

    @henrywright

    Great to see you figured this out. You probably want to let the function return naturally without using die("END");?


    vieiraadsv
    Participant

    @vieiraadsv

    Oh yes, this is just a test code, just to see what was being printed by the function. I put this die because there is redirect after this action.


    Henry Wright
    Moderator

    @henrywright

    I put this die because there is redirect after this action.

    Right! If you don’t want the redirect then that’s one way to stop it 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to trigger hooks on member profile update?’ is closed to new replies.
Skip to toolbar