Skip to content
Docs
Get RestroPress

Action

rpress_customer_pre_set_primary_email

Updated
On this page

Fires before an email is set as the customer's primary email.

Fires in RPRESS_Customer::set_primary_email() after the address is validated, before it checks whether the address belongs to another customer. The method may still return false afterwards, so the primary email is not guaranteed to change.

Parameters#

ParameterTypeDescription
$new_primary_emailstringThe email address being made primary.
$customer_idintThe customer ID.
$customerRPRESS_CustomerThe customer object.

Example#

function my_customer_pre_set_primary_email( $new_primary_email, $customer_id, $customer ) {
	error_log( 'Customer ' . $customer_id . ' primary email -> ' . $new_primary_email );
}
add_action( 'rpress_customer_pre_set_primary_email', 'my_customer_pre_set_primary_email', 10, 3 );

Source#

Fired from:

  • includes/class-rpress-customer.php (line 298), in RPRESS_Customer::set_primary_email()

See also#

Was this page helpful?