From 18ac9ce0226366dfd7c670572450d84589aa2fbc Mon Sep 17 00:00:00 2001 From: champsupertramp Date: Fri, 1 Apr 2016 21:05:26 +0800 Subject: [PATCH] Add secondary email address --- core/um-actions-form.php | 2 ++ core/um-builtin.php | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/core/um-actions-form.php b/core/um-actions-form.php index 7c9b24a2..18d74b30 100644 --- a/core/um-actions-form.php +++ b/core/um-actions-form.php @@ -372,6 +372,8 @@ $ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') ); } else if ( $args[$key] != '' && email_exists( $args[$key] ) ) { $ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') ); + } else if ( $args[$key] != '' && um_is_meta_value_exists( $key, $args[ $key ] ) ) { + $ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') ); } } diff --git a/core/um-builtin.php b/core/um-builtin.php index e4a46ab7..acf1d143 100644 --- a/core/um-builtin.php +++ b/core/um-builtin.php @@ -649,6 +649,16 @@ class UM_Builtin { 'label' => __('E-mail Address','ultimatemember'), 'required' => 0, 'public' => 1, + 'validate' => 'unique_email', + ), + + 'secondary_user_email' => array( + 'title' => __('Secondary E-mail Address','ultimatemember'), + 'metakey' => 'secondary_user_email', + 'type' => 'text', + 'label' => __('Secondary E-mail Address','ultimatemember'), + 'required' => 0, + 'public' => 1, 'editable' => 1, 'validate' => 'unique_email', ),