mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
Fix role validation on registration process
This commit is contained in:
+10
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user