MDL-82554 question: Allow null createdby in question_has_capability_on.

This commit is contained in:
Michael Aherne
2024-07-23 10:45:09 +01:00
parent 8efeae492e
commit 66ebd9db13
2 changed files with 30 additions and 1 deletions
+1 -1
View File
@@ -1434,7 +1434,7 @@ function question_has_capability_on($questionorid, $cap, $notused = -1): bool {
} else if (is_object($questionorid)) {
// All we really need in this function is the contextid and author of the question.
// We won't bother fetching other details of the question if these 2 fields are provided.
if (isset($questionorid->contextid) && isset($questionorid->createdby)) {
if (isset($questionorid->contextid) && property_exists($questionorid, 'createdby')) {
$question = $questionorid;
} else if (!empty($questionorid->id)) {
$questionid = $questionorid->id;