mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-15 12:43:33 +09:00
Add option to allow primary email editable in profile view
This commit is contained in:
@@ -358,7 +358,9 @@
|
||||
|
||||
if ( $args[$key] == '' && in_array( $key, array('user_email') ) ) {
|
||||
$ultimatemember->form->add_error($key, __('You must provide your email','ultimatemember') );
|
||||
} else if ( $mode == 'register' && email_exists( $args[$key] ) ) {
|
||||
} else if ( in_array( $mode, array('register') ) && email_exists( $args[$key] ) ) {
|
||||
$ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
|
||||
} else if ( in_array( $mode, array('profile') ) && email_exists( $args[$key] ) != $args['user_id'] ) {
|
||||
$ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
|
||||
} else if ( !is_email( $args[$key] ) ) {
|
||||
$ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') );
|
||||
|
||||
+7
-1
@@ -909,7 +909,13 @@ class UM_Fields {
|
||||
if ( !um_can_edit_field( $data ) ) return;
|
||||
|
||||
// fields that need to be disabled in edit mode (profile)
|
||||
if ( in_array( $key, array('user_email','username','user_login','user_password') ) && $this->editing == true && $this->set_mode == 'profile' ) {
|
||||
$arr_restricted_fields = array('user_email','username','user_login','user_password');
|
||||
|
||||
if( um_get_option('editable_primary_email_in_profile') == 1 ){
|
||||
unset( $arr_restricted_fields[0] ); // remove user_email
|
||||
}
|
||||
|
||||
if ( in_array( $key, $arr_restricted_fields ) && $this->editing == true && $this->set_mode == 'profile' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -202,6 +202,16 @@ $this->sections[] = array(
|
||||
'off' => __('Off','ultimatemember'),
|
||||
),
|
||||
|
||||
array(
|
||||
'id' => 'editable_primary_email_in_profile',
|
||||
'type' => 'switch',
|
||||
'title' => __( 'Editable primary email field in profile view','ultimatemember' ),
|
||||
'default' => 0,
|
||||
'desc' => __('Allow users to edit their primary emails in profile view ( when email address field is added only )','ultimatemember'),
|
||||
'on' => __('On','ultimatemember'),
|
||||
'off' => __('Off','ultimatemember'),
|
||||
),
|
||||
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user