From 7d56652db89f486e115e4f18e3d158cef6c05660 Mon Sep 17 00:00:00 2001 From: Champ Camba Date: Wed, 23 Nov 2016 11:32:47 +0800 Subject: [PATCH] Remove notices --- core/um-form.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/core/um-form.php b/core/um-form.php index d3eed5f9..d2dea939 100644 --- a/core/um-form.php +++ b/core/um-form.php @@ -114,18 +114,22 @@ class UM_Form { $custom_field_roles = $this->custom_field_roles( $this->form_data['custom_fields'] ); - $role = $_POST['role']; + if( isset( $_POST['role'] ) ){ + $role = $_POST['role']; - if( is_array( $_POST['role'] ) ){ - $role = current( $_POST['role'] ); - } + if( is_array( $_POST['role'] ) ){ + $role = current( $_POST['role'] ); + } - if ( isset( $custom_field_roles ) && is_array( $custom_field_roles ) && ! in_array( $role , $custom_field_roles ) ) { - wp_die( __( 'This is not possible for security reasons.','ultimatemember') ); - } + if ( isset( $custom_field_roles ) && is_array( $custom_field_roles ) && ! in_array( $role , $custom_field_roles ) ) { + wp_die( __( 'This is not possible for security reasons.','ultimatemember') ); + } - $this->post_form['role'] = $role; - $this->post_form['submitted']['role'] = $role; + $this->post_form['role'] = $role; + $this->post_form['submitted']['role'] = $role; + } + + }else if( isset( $this->post_form['mode'] ) && $this->post_form['mode'] == 'register' ) { $role = $this->assigned_role( $this->form_id );