mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixed roles fields;
This commit is contained in:
@@ -2094,7 +2094,7 @@
|
||||
$field_value = array();
|
||||
|
||||
if ( ! empty( $options ) ) {
|
||||
foreach ($options as $k => $v) {
|
||||
foreach ( $options as $k => $v ) {
|
||||
|
||||
$v = rtrim( $v );
|
||||
|
||||
@@ -2319,10 +2319,21 @@
|
||||
$exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) );
|
||||
|
||||
$roles = UM()->roles()->get_roles( false, $exclude_roles );
|
||||
if ( ! empty( $options ) )
|
||||
|
||||
if ( ! empty( $options ) ) {
|
||||
//fix when customers change options for role (radio/dropdown) fields
|
||||
foreach ( $roles as $role_key => $role_title ) {
|
||||
if ( false !== $search_key = array_search( $role_title, $options ) ) {
|
||||
if ( $role_key != $search_key ) {
|
||||
$options[ $role_key ] = $role_title;
|
||||
unset( $options[ $search_key ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
$options = array_intersect( $options, $roles );
|
||||
else
|
||||
} else {
|
||||
$options = $roles;
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user