Automattic\WooCommerce\Internal\CustomerEmailVerification
EmailVerificationService::mark_verified
Mark the given user as having verified their current account email address.
Stores the verified email address, clears any pending key, and fires the woocommerce_customer_email_verified action. No-ops if the user is already verified for their current email.
Method of the class: EmailVerificationService{}
Hooks from the method
Returns
void. Nothing (null).
Usage
$EmailVerificationService = new EmailVerificationService(); $EmailVerificationService->mark_verified( $user_id ): void;
- $user_id(int) (required)
- WordPress user ID.
Changelog
| Since 11.0.0 | Introduced. |
EmailVerificationService::mark_verified() EmailVerificationService::mark verified code WC 11.1.2
public function mark_verified( int $user_id ): void {
if ( $this->is_verified( $user_id ) ) {
return;
}
$account_email = $this->get_account_email( $user_id );
if ( null === $account_email ) {
return;
}
// Storing the email (not a bool) lets the status self-invalidate if the account email later changes.
Users::update_site_user_meta( $user_id, self::VERIFIED_META, $account_email );
Users::delete_site_user_meta( $user_id, self::KEY_META );
/**
* Fires after a customer has verified their email address.
*
* @param int $user_id The WordPress user ID of the verified customer.
*
* @since 11.0.0
*/
do_action( 'woocommerce_customer_email_verified', $user_id );
}