From b91ad10cfa7d174eb61793578408b22187e88604 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Mon, 18 Sep 2017 16:04:03 +0300 Subject: [PATCH] - fixed roles dropdown, when edit options at backend edit field modal window; --- includes/core/class-fields.php | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php index 548fab0c..76daffb4 100644 --- a/includes/core/class-fields.php +++ b/includes/core/class-fields.php @@ -1841,21 +1841,11 @@ if ( ! class_exists( 'Fields' ) ) { // role field if ( $form_key == 'role' ) { -/* global $wpdb; - foreach($options as $key => $val ) { - $val = (string) $val; - $val = trim( $val ); - $post_id = $wpdb->get_var( - $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'um_role' AND ( post_name = %s OR post_title = %s )", $key, $val ) - ); - $_role = get_post( $post_id ); - if( isset( $_role->post_title ) ){ - $new_roles[ $_role->post_name ] = $_role->post_title; - } - wp_reset_postdata(); - }*/ - - $options = UM()->roles()->get_roles( false, array( 'administrator' ) ); + $roles = UM()->roles()->get_roles( false, array( 'administrator' ) ); + if ( isset( $options ) ) + $options = array_intersect( $options, $roles ); + else + $options = $roles; } // add an empty option!