getType() : 'wpamelia-customer'; // Get the wp name of capability we are looking for. $wpCapability = "amelia_{$permission}_{$object}"; if ($user !== null && $user->getExternalId() !== null) { return user_can($user->getExternalId()->getValue(), $wpCapability); } // If user is guest check does it have capability $wpRole = get_role($wpRoleName); return $wpRole !== null && isset($wpRole->capabilities[$wpCapability]) ? (bool)$wpRole->capabilities[$wpCapability] : false; } }