mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixed conditional logic;
- fixed roles field notice;
This commit is contained in:
@@ -1225,6 +1225,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
$array['conditional'] .= ' data-cond-' . $cond_id . '-action="' . $cond[0] . '" data-cond-' . $cond_id . '-field="' . $cond[1] . '" data-cond-' . $cond_id . '-operator="' . $cond[2] . '" data-cond-' . $cond_id . '-value="' . $cond[3] . '"';
|
||||
}
|
||||
|
||||
$array['classes'] .= ' um-is-conditional';
|
||||
|
||||
} else {
|
||||
$array['conditional'] = null;
|
||||
}
|
||||
|
||||
@@ -384,19 +384,25 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Get editable UM user roles
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_editable_user_roles() {
|
||||
// User has roles so look for a UM Role one
|
||||
$um_roles_keys = get_option( 'um_roles' );
|
||||
$default_roles = array( 'subscriber' );
|
||||
|
||||
if ( ! empty( $um_roles_keys ) ) {
|
||||
// User has roles so look for a UM Role one
|
||||
$um_roles_keys = get_option( 'um_roles', array() );
|
||||
|
||||
if ( ! empty( $um_roles_keys ) && is_array( $um_roles_keys ) ) {
|
||||
$um_roles_keys = array_map( function( $item ) {
|
||||
return 'um_' . $item;
|
||||
}, $um_roles_keys );
|
||||
|
||||
return array_merge( $um_roles_keys, $default_roles );
|
||||
}
|
||||
|
||||
return array_merge( $um_roles_keys, array( 'subscriber' ) );
|
||||
return $default_roles;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user