• Resolved Dinesh

    (@dinesh7cw)


    HI,

    In the site, users will register using a custom registration form, and after registration, the user will be approved by an admin. During this process, I need to trigger a function once the user has registered. let me know how to do this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Sandip Pokhrel

    (@sandippokharel)

    Hi @dinesh7cw

    Thanks for writing in,

    Please refer to the link below to find the hook used after the user is approved by the admin.

    https://docs.wpuserregistration.com/docs/available-hooks/#0-toc-title

    Does this help?

    Regards!

    Plugin Support Sandip Pokhrel

    (@sandippokharel)

    Hi @dinesh7cw,

    Since we haven’t heard from you in a while, I’m going to go ahead and conclude this thread for now. However, if you have any further questions or if there’s anything else we can assist you with, please feel free to continue the conversation.

    Regards!

    Thread Starter Dinesh

    (@dinesh7cw)

    Hi @sandippokharel

    We have tried the hook “user_registration_after_register_user_action” to run a function after the user is registered, in have created a form with the extra input fields and after the form is submitted the data is stored in the “User Extra Information” i need to get and update the details in the WooCommerce billing information i tried the below function but the function is not triggering after a user is registered.

    add_action( ‘user_registration_after_register_user_action’, ‘user_registration_after_email_confirmation’, 10, 2 );

    function user_registration_after_email_confirmation( $user_id, $user_reg_successful ) {
    // Check if the email confirmation was successful
    if ( ! $user_reg_successful ) {
    return;
    }

    // Retrieve the form data from user meta
    $address = get_user_meta( $user_id, ‘user_registration_address’, true );
    $phone = get_user_meta( $user_id, ‘user_registration_phone’, true );
    $country = get_user_meta( $user_id, ‘user_registration_country’, true );
    $zip_code = get_user_meta( $user_id, ‘user_registration_zip_code’, true );

    // Update WooCommerce billing information
    update_user_meta($user_id, ‘billing_address_1’, $address);
    update_user_meta($user_id, ‘billing_phone’, $phone);
    update_user_meta($user_id, ‘billing_country’, $country);
    update_user_meta($user_id, ‘billing_postcode’, $zip_code);

    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.