mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- added filter for making 3rd-party roles editable through Ultimate Member interfaces. Use 'um_extend_editable_roles' and pass there an array of role keys( e.g. 'editor', 'administrator', etc. );
- reviewed and closed #1151;
This commit is contained in:
@@ -2112,18 +2112,8 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
//if isset roles argument validate role to properly for security reasons
|
||||
if ( isset( $args['role'] ) ) {
|
||||
global $wp_roles;
|
||||
$um_roles = get_option( 'um_roles', array() );
|
||||
|
||||
if ( ! empty( $um_roles ) ) {
|
||||
$role_keys = array_map( function( $item ) {
|
||||
return 'um_' . $item;
|
||||
}, $um_roles );
|
||||
} else {
|
||||
$role_keys = array();
|
||||
}
|
||||
|
||||
$exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) );
|
||||
|
||||
$exclude_roles = array_diff( array_keys( $wp_roles->roles ), UM()->roles()->get_editable_user_roles() );
|
||||
if ( in_array( $args['role'], $exclude_roles ) ) {
|
||||
unset( $args['role'] );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user