mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
Merge pull request #1578 from ultimatemember/fix/registration_role
Fixes validation of the form slug
This commit is contained in:
@@ -1075,7 +1075,9 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
$global_role = get_option( 'default_role' ); // WP Global settings
|
||||
|
||||
$um_global_role = UM()->options()->get( 'register_role' ); // UM Settings Global settings
|
||||
if ( ! empty( $um_global_role ) ) {
|
||||
|
||||
$existing_roles = array_keys( wp_roles()->roles );
|
||||
if ( ! empty( $um_global_role ) && in_array( $um_global_role, $existing_roles, true ) ) {
|
||||
$global_role = $um_global_role; // Form Global settings
|
||||
}
|
||||
|
||||
@@ -1089,7 +1091,7 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
$role = get_post_meta( $post_id, "_um_{$mode}_role", true );
|
||||
}
|
||||
|
||||
if ( empty( $role ) ) { // custom role is default, return default role's slug
|
||||
if ( empty( $role ) || ! in_array( $role, $existing_roles, true ) ) { // custom role is default, return default role's slug
|
||||
$role = $global_role;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user