onfirm redirect. * @return array{0: string, 1: string}|null */ private function result_notice( string $code ): ?array { switch ( $code ) { case 'sent': return array( __( 'A confirmation link has been sent to your email address. Please check your inbox.', 'woocommerce' ), 'success' ); case 'throttled': return array( __( 'A confirmation link was sent recently. Please check your inbox, or wait a moment before requesting a new one.', 'woocommerce' ), 'notice' ); case 'confirmed': return array( __( 'Your email address has been confirmed.', 'woocommerce' ), 'success' ); case 'expired': return array( __( 'This confirmation link is invalid or has expired. Please request a new one.', 'woocommerce' ), 'error' ); case 'mismatch': return array( __( 'Unable to confirm this email while you are logged in to a different account. Please log out and open the link again.', 'woocommerce' ), 'error' ); case 'invalid': return array( __( 'Invalid request. Please try again.', 'woocommerce' ), 'error' ); default: return null; } } /** * Redirect to the orders section carrying a one-off result code, then exit. * * @param string $code Result code understood by {@see self::result_notice()}. * @return never */ private function redirect_with_result( string $code ): void { wp_safe_redirect( add_query_arg( self::NOTICE_PARAM, $code, wc_get_account_endpoint_url( 'orders' ) ) ); exit; } /** * Validate a key and verify the user. * * @since 11.0.0 * * @param int $user_id User ID. * @param string $key Plaintext verification key. * @return bool True when verification succeeded. */ public function process_verification( int $user_id, string $key ): bool { if ( ! $user_id || '' === $key ) { return false; } if ( ! $this->service->check_verification_key( $user_id, $key ) ) { return false; } $this->service->mark_verified( $user_id ); return true; } /** * Send (or resend) a verification email to a user. * * @since 11.0.0 * * @param int $user_id User ID. */ public function send_verification_email( int $user_id ): void { $user = get_user_by( 'id', $user_id ); if ( ! $user ) { return; } $verify_url = $this->service->build_verification_url( $user_id ); WC()->mailer(); /** * Triggers sending of the customer email-verification email. * * @param int $user_id The WordPress user ID of the customer. * @param string $verify_url The one-time verification URL to include in the email. * * @since 11.0.0 */ do_action( 'woocommerce_customer_verify_email_notification', $user_id, $verify_url ); } }