From 5ad3d3e26911c24b7c2a8fdf140f8bcffaa3ea94 Mon Sep 17 00:00:00 2001 From: Mario Voigt Date: Thu, 14 Nov 2024 20:58:12 +0100 Subject: [PATCH] Update authMgrPlus/:plugin.php https://github.com/joshp23/YOURLS-AuthMgrPlus/pull/56/files#diff-eb4ee33da0272269a1891c5860eafeab0a7eb403697c1aa36fd75b8c3b80063b --- authMgrPlus/:plugin.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/authMgrPlus/:plugin.php b/authMgrPlus/:plugin.php index 08eaa71..8d139c7 100644 --- a/authMgrPlus/:plugin.php +++ b/authMgrPlus/:plugin.php @@ -272,11 +272,12 @@ function amp_have_capability( $capability ) { // List capabilities of particular user role $user = defined('YOURLS_USER') ? YOURLS_USER : NULL; $user_caps = array(); - if ( amp_user_is_assigned ( $user ) ) + if ( amp_user_is_assigned ( $user ) ) { foreach ( $amp_role_capabilities as $rolename => $rolecaps ) if ( amp_user_has_role( $user, $rolename ) ) $user_caps = array_merge( $user_caps, $rolecaps ); - + } + elseif ( isset( $amp_default_role ) && in_array ($amp_default_role, array_keys( $amp_role_capabilities ) ) ) $user_caps = $amp_role_capabilities [ $amp_default_role ];