0

I have created a custom plugin that will provide some custom user roles that are named customers and operators. When an user will create a new account, I've created some logics that imply that operators need to approve the new accounts. Using the wp_insert_user() I'm able to save new users into the database and thay will not get the login password to this step, after operators approval they will get a password generated using the wp_generate_password() function. At the moment, what I want to achive si to disable password change notification so the users will only get the emails I want to send them, so, a first email that will inform about the account status and the second that will give them the credentials after 24 hours from approval.

I've readed the documentation about send_password_change_email and it will be a lot clear about the filter. At the moment I have this code

$password = wp_generate_password( 12, true, true );
//
$assigned_card_number = get_user_meta( (int)$customer_details['ID'], 'num_tessera', true );
//

    $user = wp_update_user( 
               array(
                'ID' => (int)$customer_details['ID'],
                'user_pass' => $password,
                'meta_input' => array(
                'account_details_sent' => true
               )
              ) 
            );

Can I call the filter after I've used the wp_update_user function and inside the same method?

2
  • It's not entirely clear what the goal is. Are you trying to not call send_password_change_email at all and use your own mailing method? Do you want to customize the send_password_change_email filter for your 24-hour window?
    – Howdy_McGee
    Nov 18 at 1:20
  • @Howdy_McGee I need that the password change email isn't sended to the user when the system update the user meta informations. I will send to it the password in a separate email with other details registration. How I call the filter before wp_update_user function?
    – ICTDEV
    Nov 20 at 9:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.