Skip to content

Commit

Permalink
MDL-56994 mod_forum: Auto-create news forum if course format supports it
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Nov 21, 2016
1 parent e47d61e commit 25bfa25
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mod/forum/classes/observer.php
Expand Up @@ -124,8 +124,8 @@ public static function course_created(\core\event\course_created $event) {
global $CFG;

$course = $event->get_record_snapshot('course', $event->objectid);

if (!empty($course->newsitems)) {
$format = course_get_format($course);
if ($format->supports_news() && !empty($course->newsitems)) {
require_once($CFG->dirroot . '/mod/forum/lib.php');
// Auto create the announcements forum.
forum_get_course_forum($event->objectid, 'news');
Expand All @@ -142,8 +142,8 @@ public static function course_updated(\core\event\course_updated $event) {
global $CFG;

$course = $event->get_record_snapshot('course', $event->objectid);

if (!empty($course->newsitems)) {
$format = course_get_format($course);
if ($format->supports_news() && !empty($course->newsitems)) {
require_once($CFG->dirroot . '/mod/forum/lib.php');
// Auto create the announcements forum.
forum_get_course_forum($event->objectid, 'news');
Expand Down

0 comments on commit 25bfa25

Please sign in to comment.