WC_Email_Customer_New_Account::generate_set_password_urlprotectedWC 6.0.0

Generate set password URL link for a new user.

Метод класса: 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 10.3.4

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 ) ) {
		// 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' );
	}

	return sprintf( '%s?action=newaccount&key=%s&login=%s', wc_get_account_endpoint_url( 'lost-password' ), $key, rawurlencode( $this->object->user_login ) );
}