mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
accesslib - Remove some notices when user is not logged in
This commit is contained in:
parent
2cb1ee78e4
commit
7fde45a7e6
@ -510,7 +510,7 @@ function has_capability($capability, $context, $userid=NULL, $doanything=true) {
|
||||
}
|
||||
$USER->access = $ACCESSLIB_PRIVATE->accessdatabyuser[$userid];
|
||||
|
||||
} else if ($USER->id == $userid && !isset($USER->access)) {
|
||||
} else if (isset($USER->id) && ($USER->id == $userid) && !isset($USER->access)) {
|
||||
// caps not loaded yet - better to load them to keep BC with 1.8
|
||||
// not-logged-in user or $USER object set up manually first time here
|
||||
load_all_capabilities();
|
||||
@ -549,7 +549,7 @@ function has_capability($capability, $context, $userid=NULL, $doanything=true) {
|
||||
// divulge how many times we are called
|
||||
//// error_log("has_capability: id:{$context->id} path:{$context->path} userid:$userid cap:$capability");
|
||||
|
||||
if ($USER->id == $userid) { // we must accept strings and integers in $userid
|
||||
if (isset($USER->id) && ($USER->id == $userid)) { // we must accept strings and integers in $userid
|
||||
//
|
||||
// For the logged in user, we have $USER->access
|
||||
// which will have all RAs and caps preloaded for
|
||||
|
Loading…
x
Reference in New Issue
Block a user