diff --git a/includes/admin/assets/css/um-admin-global.css b/includes/admin/assets/css/um-admin-global.css index c33b5c1f..b38567b6 100644 --- a/includes/admin/assets/css/um-admin-global.css +++ b/includes/admin/assets/css/um-admin-global.css @@ -3,6 +3,11 @@ color: #555; } +.um-admin-notice.notice-warning { + border-color: #dba617 !important; + color: #555; +} + .um-admin-notice.upgraded { border-color: #0085ba !important; color: #555; diff --git a/includes/admin/core/class-admin-notices.php b/includes/admin/core/class-admin-notices.php index 561aba7d..166ea198 100644 --- a/includes/admin/core/class-admin-notices.php +++ b/includes/admin/core/class-admin-notices.php @@ -803,6 +803,68 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { 1 ); } + + $this->check_registration_forms(); + } + + private function check_registration_forms() { + $um_forms = get_posts( + array( + 'post_type' => 'um_form', + 'meta_query' => array( + array( + 'key' => '_um_mode', + 'value' => 'register', + ), + array( + 'key' => '_um_register_use_custom_settings', + 'value' => true, + ), + ), + 'numberposts' => -1, + 'fields' => 'ids', + ) + ); + + $content = ''; + $arr_banned_caps = UM()->options()->get( 'banned_capabilities' ); + + foreach ( $um_forms as $form_id ) { + $role = get_post_meta( $form_id, '_um_register_role', true ); + if ( empty( $role ) ) { + continue; + } + + $caps = get_role( $role )->capabilities; + foreach ( array_keys( $caps ) as $cap ) { + if ( in_array( $cap, $arr_banned_caps, true ) ) { + $content .= '
' . get_the_title( $form_id ) . ' contains administrative role.'; + break; + } + } + } + + if ( empty( $content ) ) { + return; + } + + ob_start(); + ?> +

+ + get_allowed_html( 'admin_notice' ) ); ?> +

+ add_notice( + 'forms_secure_suspicious_activity', + array( + 'class' => 'notice-warning', + 'message' => $message, + 'dismissible' => true, + ), + 1 + ); } public function dismiss_notice() { diff --git a/includes/core/class-form.php b/includes/core/class-form.php index 5a117136..7106e3ae 100644 --- a/includes/core/class-form.php +++ b/includes/core/class-form.php @@ -494,10 +494,8 @@ if ( ! class_exists( 'um\core\Form' ) ) { $cf_metakeys[] = 'profile_photo'; $cf_metakeys[] = 'cover_photo'; - if ( array_key_exists( 'show_bio', $this->form_data ) ) { - if ( ! empty( $this->form_data['show_bio'] ) ) { - $cf_metakeys[] = UM()->profile()->get_show_bio_key( $this->form_data ); - } + if ( ! empty( $this->form_data['use_custom_settings'] ) && ! empty( $this->form_data['show_bio'] ) ) { + $cf_metakeys[] = UM()->profile()->get_show_bio_key( $this->form_data ); } else { if ( UM()->options()->get( 'profile_show_bio' ) ) { $cf_metakeys[] = UM()->profile()->get_show_bio_key( $this->form_data );