MDL-34711 mod_forum Calling forum_trigger_content_uploaded_event only with the course...
authorDavid Monllao <davidm@moodle.com>
Fri, 3 Aug 2012 03:05:30 +0000 (11:05 +0800)
committerDavid Monllao <davidm@moodle.com>
Fri, 3 Aug 2012 03:05:30 +0000 (11:05 +0800)
mod/forum/lib.php

index 8ee61ae..7bef4f2 100644 (file)
@@ -4437,7 +4437,9 @@ function forum_add_discussion($discussion, $mform=null, &$message=null, $userid=
     }
 
     // Let Moodle know that assessable content is uploaded (eg for plagiarism detection)
     }
 
     // Let Moodle know that assessable content is uploaded (eg for plagiarism detection)
-    forum_trigger_content_uploaded_event($post, $cm, 'forum_add_discussion');
+    if (!empty($cm->id)) {
+        forum_trigger_content_uploaded_event($post, $cm, 'forum_add_discussion');
+    }
 
     return $post->discussion;
 }
 
     return $post->discussion;
 }