Fix role validation on registration process

This commit is contained in:
champsupertramp
2016-09-06 20:14:12 +08:00
parent 26b8226d5d
commit 37354a5eae
+10 -1
View File
@@ -117,11 +117,20 @@ class UM_Form {
&& $secure_form_post ){ // Secure selected role
$custom_field_roles = $this->custom_field_roles( $this->form_data['custom_fields'] );
$role = $_POST['role'];
if ( isset( $custom_field_roles ) && ! in_array( $_POST['role'] ,$custom_field_roles ) ) {
if( is_array( $_POST['role'] ) ){
$role = current( $_POST['role'] );
}
if ( isset( $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;
}else{
$role = $this->assigned_role( $this->form_id );
$this->post_form['role'] = $role;