Mario Voigt 2024-11-14 20:58:12 +01:00
parent a936333a97
commit 5ad3d3e269

View File

@ -272,10 +272,11 @@ 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 ];