From de07ea53c63f1647039b949807e2338b97d1bc46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Tue, 23 Jun 2020 11:20:50 +0200 Subject: [PATCH] amp_default_role for logged-in users (that have no explicit role) --- authMgrPlus/plugin.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/authMgrPlus/plugin.php b/authMgrPlus/plugin.php index a1a2aab..94f71b1 100644 --- a/authMgrPlus/plugin.php +++ b/authMgrPlus/plugin.php @@ -219,6 +219,7 @@ function amp_have_capability( $capability ) { global $amp_anon_capabilities; global $amp_role_capabilities; global $amp_admin_ipranges; + global $amp_default_role; // Make sure the environment has been setup amp_env_check(); @@ -253,6 +254,12 @@ function amp_have_capability( $capability ) { break; } } + if( !$return ) { + if ( isset( $amp_default_role ) && in_array ($amp_default_role, array_keys( $amp_role_capabilities ) ) ) { + $default_caps = $amp_role_capabilities [ $amp_default_role ]; + $return = in_array( $capability, $default_caps ); + } + } return $return; }