Merge remote-tracking branch 'remotes/origin/origin/release/2.0.18_fix_roles' into release/2.0.18

This commit is contained in:
nikitozzzzzzz
2018-06-18 11:53:58 +03:00
3 changed files with 10 additions and 12 deletions
+8 -5
View File
@@ -1720,7 +1720,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
case 'select':
case 'radio':
$form_key = str_replace( 'role_select', 'role', $key );
$form_key = str_replace( array( 'role_select', 'role_radio' ), 'role', $key );
$field_id = $form_key;
break;
default:
@@ -2601,9 +2601,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
}
}
$options = $this->get_available_roles( $form_key, $options );
// add an empty option!
$output .= '<option value=""></option>';
$field_value = '';
@@ -2920,7 +2917,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$um_field_checkbox_item_title = $v;
$option_value = $v;
if ( ! is_numeric( $k ) && in_array( $form_key, array( 'role', 'role_radio' ) ) ) {
if ( ! is_numeric( $k ) && in_array( $form_key, array( 'role' ) ) ) {
$um_field_checkbox_item_title = $v;
$option_value = $k;
}
@@ -2932,6 +2929,11 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$col_class = '';
}
if ( $form_key == 'role' ) {
$option_value = strtolower( str_replace( ' ', '-', $option_value ) );
$option_value = in_array( $option_value, get_option( 'um_roles' ) ) ? 'um_' . $option_value : $option_value;
}
if ($this->is_radio_checked( $key, $option_value, $data )) {
$active = 'active';
$class = "um-icon-android-radio-button-on";
@@ -2940,6 +2942,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$class = "um-icon-android-radio-button-off";
}
if (isset( $data['editable'] ) && $data['editable'] == 0) {
$col_class .= " um-field-radio-state-disabled";
}
@@ -418,6 +418,7 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
$um_roles_keys = array_map( function( $item ) {
return 'um_' . $item;
}, $um_roles_keys );
}
$orders = array();
+1 -7
View File
@@ -1657,18 +1657,12 @@ if ( ! class_exists( 'um\core\User' ) ) {
*/
$changes = apply_filters('um_before_update_profile', $changes, $this->id );
// save or update profile meta
foreach ( $changes as $key => $value ) {
if ( ! in_array( $key, $this->update_user_keys ) ) {
update_user_meta( $this->id, $key, $value );
} else {
$args[$key] = esc_attr( $changes[$key] );
$args[$key] = esc_attr( $changes['role_radio'] );
}
}