Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.

fix: fixes issue where default role was not correctly applied #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions authMgrPlus/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,15 @@ 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 ) ) )
elseif ( isset( $amp_default_role ) && in_array ($amp_default_role, array_keys( $amp_role_capabilities ) ) ){
$user_caps = $amp_role_capabilities [ $amp_default_role ];

}
$user_caps = array_unique( $user_caps );
// Is the requested capability in this list?
$return = in_array( $capability, $user_caps );
Expand Down