WordPress at Your Fingertips
function is not described

WC_Email_Customer_New_Account::generate_set_password_url() protected WC 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.

{} It's a method of the class: WC_Email_Customer_New_Account{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->generate_set_password_url();

Changelog

Since 6.0.0 Introduced.

Code of WC_Email_Customer_New_Account::generate_set_password_url() WC 6.1.1

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