From 5fe904adc225d51dbd886fe97e61976209f9c077 Mon Sep 17 00:00:00 2001 From: skodak Date: Tue, 13 Feb 2007 19:25:04 +0000 Subject: [PATCH] MDL-8490 Glossary student not being able to edit entries --- mod/glossary/edit.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mod/glossary/edit.php b/mod/glossary/edit.php index 66054d158b..e2656ad14b 100644 --- a/mod/glossary/edit.php +++ b/mod/glossary/edit.php @@ -33,8 +33,16 @@ if (! $glossary = get_record("glossary", "id", $cm->instance)) { error("Course module is incorrect"); } + if ($e) { // if entry is specified - require_capability('mod/glossary:manageentries', $context); + if (!$entry = get_record("glossary_entries", "id", $e)) { + error("Incorrect entry id"); + } + $ineditperiod = ((time() - $entry->timecreated < $CFG->maxeditingtime) || $glossary->editalways); + if (!has_capability('mod/glossary:manageentries', $context) and !($entry->userid == $USER->id and ($ineditperiod and has_capability('mod/glossary:write', $context)))) { + //expired edit time is the most probable cause here + error(get_string('erredittimeexpired', 'glossary'), "view.php?id=$cm->id&mode=entry&hook=$e"); + } } else { // new entry require_capability('mod/glossary:write', $context); } -- 2.39.5