WC_Email_Customer_New_Account::generate_set_password_url()protectedWC 6.0.0

Generate set password URL link for a new user.

See also Automattic\WooCommerce\Blocks\Domain\Services\Email\CustomerNewAccount and wp_new_user_notification.

Метод класса: WC_Email_Customer_New_Account{}

Хуков нет.

Возвращает

Строку.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->generate_set_password_url();

Список изменений

С версии 6.0.0 Введена.

Код WC_Email_Customer_New_Account::generate_set_password_url() WC 9.4.2

protected function generate_set_password_url() {
	// Generate a magic link so user can set initial password.
	$key = get_password_reset_key( $this->object );
	if ( ! is_wp_error( $key ) ) {
		$action                 = 'newaccount';
		return wc_get_account_endpoint_url( 'lost-password' ) . "?action=$action&key=$key&login=" . rawurlencode( $this->object->user_login );
	} else {
		// Something went wrong while getting the key for new password URL, send customer to the generic password reset.
		return wc_get_account_endpoint_url( 'lost-password' );
	}
}