In debug mode, warn people if they are asking for an unknown capability.

This commit is contained in:
tjhunt
2006-09-19 22:57:17 +00:00
parent 8cd402f900
commit a8a7300acc
+4
View File
@@ -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