From a8a7300accdf2f4cce8597b3ad2319ce1d03e247 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Tue, 19 Sep 2006 22:57:17 +0000 Subject: [PATCH] In debug mode, warn people if they are asking for an unknown capability. --- lib/accesslib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/accesslib.php b/lib/accesslib.php index 1f5d8aeb5c..13d94fb75d 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -272,6 +272,10 @@ function has_capability($capability, $context=NULL, $userid=NULL, $doanything=tr global $USER, $CONTEXT, $CFG; + if (debugging() && !record_exists('capabilities', 'name', $capability)) { + debugging("Checking for unknown cabability '$capability' in context {$context->id}."); + } + if (empty($userid) && empty($USER->capabilities)) { // Real user, first time here if (isloggedin()) { load_defaultuser_role(); // All users get this by default -- 2.39.5