Automattic\WooCommerce\Blocks\Domain\Services\Email
CustomerNewAccount::trigger()
Trigger.
Method of the class: CustomerNewAccount{}
No Hooks.
Return
null
. Nothing (null).
Usage
$CustomerNewAccount = new CustomerNewAccount(); $CustomerNewAccount->trigger( $user_id, $user_pass, $password_generated );
- $user_id(int) (required)
- User ID.
- $user_pass(string)
- User password.
Default: '' - $password_generated(true|false)
- Whether the password was generated automatically or not.
Default: false
CustomerNewAccount::trigger() CustomerNewAccount::trigger code WC 9.7.1
public function trigger( $user_id, $user_pass = '', $password_generated = false ) { $this->setup_locale(); if ( $user_id ) { $this->object = new \WP_User( $user_id ); // Generate a magic link so user can set initial password. $key = get_password_reset_key( $this->object ); if ( ! is_wp_error( $key ) ) { $action = 'newaccount'; $this->set_password_url = wc_get_account_endpoint_url( 'lost-password' ) . "?action=$action&key=$key&login=" . rawurlencode( $this->object->user_login ); } $this->user_login = stripslashes( $this->object->user_login ); $this->user_email = stripslashes( $this->object->user_email ); $this->recipient = $this->user_email; } if ( $this->is_enabled() && $this->get_recipient() ) { $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments(), $this->set_password_url ); } $this->restore_locale(); }