You appear to be a bot. Output may be restricted
Description
Attach an email to the customer
Usage
$bool = EDD_Customer::add_email( $email, $primary );
Parameters
- ( string ) optional – The email address to remove from the customer
- $primary
- ( bool ) optional – Allows setting the email added as the primary
Returns
bool If the email was added successfully
Source
File name: easy-digital-downloads/includes/class-edd-customer.php
Lines:
1 to 34 of 34
public function add_email( $email = '', $primary = false ) { if( ! is_email( $email ) ) { return false; } $existing = new EDD_Customer( $email ); if( $existing->id > 0 ) { // Email address already belongs to a customer return false; } if ( email_exists( $email ) ) { $user = get_user_by( 'email', $email ); if ( $user->ID != $this->user_id ) { return false; } } do_action( 'edd_customer_pre_add_email', $email, $this->id, $this ); // Update is used to ensure duplicate emails are not added $ret = (bool) $this->add_meta( 'additional_email', $email ); do_action( 'edd_customer_post_add_email', $email, $this->id, $this ); if ( $ret && true === $primary ) { $this->set_primary_email( $email ); } return $ret; }