Make News on Front Page viewable to Teachers only: Difference between revisions
From MoodleDocs
Helen Foster (talk | contribs) m (category) |
Helen Foster (talk | contribs) m (cat edit) |
||
Line 33: | Line 33: | ||
The lines in red are the lines you'll need to add. | The lines in red are the lines you'll need to add. | ||
[[Category: | [[Category:Contributed code]] |
Revision as of 15:31, 15 February 2008
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 = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>'. '<td><div class="title">'.$newsforum->name.'</div></td>'. '<td><div class="link"><a href="mod/forum/subscribe.php?id='.$newsforum->id.'">'.$subtext.'</a></div></td>'. '</tr></table>'; } else { $headertext = $newsforum->name; } print_heading_block($headertext); forum_print_latest_discussions($SITE, $newsforum, $SITE->newsitems); } } break;
The lines in red are the lines you'll need to add.