diff --git a/includes/admin/core/class-admin-notices.php b/includes/admin/core/class-admin-notices.php
index 5417a00d..0d68e5d7 100644
--- a/includes/admin/core/class-admin-notices.php
+++ b/includes/admin/core/class-admin-notices.php
@@ -866,6 +866,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
}
private function check_registration_forms() {
+ $arr_banned_caps = UM()->options()->get( 'banned_capabilities' );
+ if ( empty( $arr_banned_caps ) ) {
+ return;
+ }
+
$um_forms = get_posts(
array(
'post_type' => 'um_form',
@@ -884,9 +889,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
)
);
- $content = '';
- $arr_banned_caps = UM()->options()->get( 'banned_capabilities' );
-
+ $content = '';
foreach ( $um_forms as $form_id ) {
$role = get_post_meta( $form_id, '_um_register_role', true );
if ( empty( $role ) ) {
diff --git a/includes/ajax/class-secure.php b/includes/ajax/class-secure.php
index 322c32bd..9ad2c1de 100644
--- a/includes/ajax/class-secure.php
+++ b/includes/ajax/class-secure.php
@@ -340,11 +340,14 @@ class Secure {
$role = get_post_meta( $fid, '_um_register_role', true );
$caps = get_role( $role )->capabilities;
$has_banned_cap = false;
- foreach ( array_keys( $caps ) as $cap ) {
- if ( in_array( $cap, $arr_banned_caps, true ) ) {
- $content .= $br . '' . get_the_title( $fid ) . ' contains administrative role ' . $flag;
- $has_banned_cap = true;
- break;
+
+ if ( is_array( $arr_banned_caps ) ) {
+ foreach ( array_keys( $caps ) as $cap ) {
+ if ( in_array( $cap, $arr_banned_caps, true ) ) {
+ $content .= $br . '' . get_the_title( $fid ) . ' contains administrative role ' . $flag;
+ $has_banned_cap = true;
+ break;
+ }
}
}