Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Make News on Front Page viewable to Teachers only.

Make News on Front Page viewable to Teachers only: Difference between revisions

From MoodleDocs
No edit summary
No edit summary
Line 9: Line 9:
  error('Could not find or create a main news forum for the site');
  error('Could not find or create a main news forum for the site');
  }
  }
  if (isset($USER->id)) {
  if (isset($USER->id)) {
  $SESSION->fromdiscussion = $CFG->wwwroot;
  $SESSION->fromdiscussion = $CFG->wwwroot;
Line 24: Line 23:
  $headertext = $newsforum->name;
  $headertext = $newsforum->name;
  }
  }
  print_heading_block($headertext);
  print_heading_block($headertext);
  forum_print_latest_discussions($SITE, $newsforum, $SITE->newsitems);
  forum_print_latest_discussions($SITE, $newsforum, $SITE->newsitems);

Revision as of 18:49, 3 November 2006

In /index.php, look for case FRONTPAGENEWS:

case FRONTPAGENEWS:
if (isteacherinanycourse()) {
if ($SITE->newsitems) { // Print forums only when needed
require_once($CFG->dirroot .'/mod/forum/lib.php');

if (! $newsforum = forum_get_course_forum($SITE->id, 'news')) {
error('Could not find or create a main news forum for the site');
}
if (isset($USER->id)) {
$SESSION->fromdiscussion = $CFG->wwwroot;
if (forum_is_subscribed($USER->id, $newsforum->id)) {
$subtext = get_string('unsubscribe', 'forum');
} else {
$subtext = get_string('subscribe', 'forum');
}

$headertext = '

'. ''. ''. '
'.$newsforum->name.'

';

} else {
$headertext = $newsforum->name;
}
print_heading_block($headertext);
forum_print_latest_discussions($SITE, $newsforum, $SITE->newsitems);
}
}
break;