]> git.mjollnir.org Git - moodle.git/commitdiff
Now the glossary->allowcoments setting is respected. MDL-8056
authorstronk7 <stronk7>
Sun, 15 Jul 2007 22:27:16 +0000 (22:27 +0000)
committerstronk7 <stronk7>
Sun, 15 Jul 2007 22:27:16 +0000 (22:27 +0000)
Credit goes to Matt Clarkson. Thanks.

Merged from MOODLE_18_STABLE

mod/glossary/comment.php
mod/glossary/lib.php

index 99c423a868dff0daff0528ee825693ea4835840c..3a0f76249c42ab86b58e75bfe665dd6457b8f24e 100644 (file)
@@ -47,7 +47,8 @@ function glossary_comment_add() {
 
     require_login($course->id, false, $cm);
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
-    if (!$glossary->allowcomments and !has_capability('mod/glossary:comment', $context)) {
+    /// Both the configuration and capability must allow comments
+    if (!$glossary->allowcomments or !has_capability('mod/glossary:comment', $context)) {
         error('You can\'t add comments to this glossary!');
     }
 
index 07b5a2165168d08550f70aa9eff6ed79d462e58b..2793d9ba147a90125a77f7e6bb6a449a88ea2d0e 100644 (file)
@@ -833,7 +833,7 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode='',$h
     }
     $return .= glossary_print_entry_commentslink($course, $cm, $glossary, $entry,$mode,$hook,'html');
 
-    if (has_capability('mod/glossary:comment', $context)) {
+    if (has_capability('mod/glossary:comment', $context) and $glossary->allowcomments) {
         $output = true;
         $return .= ' <a title="' . get_string('addcomment','glossary') . '" href="comment.php?action=add&amp;eid='.$entry->id.'"><img src="comment.gif" class="iconsmall" alt="'.get_string('addcomment','glossary').'" /></a>';
     }