• Hello,

    We’ve set up a front-end form that allows a user with a specific role – an additional “member” role added to the existing WordPress roles – to modify the email address of their account.

    For this form, we’ve activated the “send_confirmation_on_profile_email” function, which sends a confirmation request email when a change of user email address is attempted: it works.

    For our purposes, we want to launch an action after effctive confirmation of the e-mail address, which consists in transferring the new e-mail address once confirmed (via a secure api) to an external information system. To carry out this action, we’ve found the “user_request_action_confirmed” hook, but we can’t find any resources on the famous “$request_id” that will enable us to fire the action.

    Have any of you already used this hook, and if so, how do you retrieve/identify this request identifier?

    Thanks a million in advance for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi!
    Have you seen and tried using the wp_get_user_request function to get the info you need from the request? You pass that request id and it returns an instance of the WP_User_Request class, or false. See the details of each one in the links, but also here is an example of what I would do.

    add_action( 'user_request_action_confirmed', 'my_post_email_confirmation_action');
    
    function my_post_email_confirmation_action( $request_id) {
        $user_req = wp_get_user_request( $request_id )
    
        if ( ! $user_req ) {
            return;
        }
    
        // At this point the request is confirmed to exists.
        // Verify the $user_req->action_name is what you want,
        // then send the new email to the external system.
    }

    I hope this info and the example help you. Let me know in any case!

    Thread Starter 1Spirit23

    (@1spirit23)

    Hello Kristel,

    Thank you very much for your advice and example! No, I hadn’t seen this function and indeed it seems to be going in the right direction. I’m going on vacation tonight but I’ll be testing this as soon as I get back: be sure i’ll share my feedback.

    Best regards!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Action after confirmation of email address change’ is closed to new replies.