Skip to content

Commit

Permalink
MDL-49069 mod_forum: Ability to specify default values for Forum RSS
Browse files Browse the repository at this point in the history
  • Loading branch information
rlorenzo committed Mar 10, 2015
1 parent b90f98d commit c9f2d34
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mod/forum/lang/en/forum.php
Expand Up @@ -101,6 +101,8 @@
$string['configmaxbytes'] = 'Default maximum size for all forum attachments on the site (subject to course limits and other local settings)';
$string['configoldpostdays'] = 'Number of days old any post is considered read.';
$string['configreplytouser'] = 'When a forum post is mailed out, should it contain the user\'s email address so that recipients can reply personally rather than via the forum? Even if set to \'Yes\' users can choose in their profile to keep their email address secret.';
$string['configrsstypedefault'] = 'If RSS feeds are enabled, sets the default activity type.';
$string['configrssarticlesdefault'] = 'If RSS feeds are enabled, sets the default number of articles (either discussions or posts).';
$string['configshortpost'] = 'Any post under this length (in characters not including HTML) is considered short (see below).';
$string['configtrackingtype'] = 'Default setting for read tracking.';
$string['configtrackreadposts'] = 'Set to \'yes\' if you want to track read/unread for each user.';
Expand Down Expand Up @@ -424,6 +426,7 @@
$string['rssarticles_help'] = 'This setting specifies the number of articles (either discussions or posts) to include in the RSS feed. Between 5 and 20 generally acceptable.';
$string['rsstype'] = 'RSS feed for this activity';
$string['rsstype_help'] = 'To enable the RSS feed for this activity, select either discussions or posts to be included in the feed.';
$string['rsstypedefault'] = 'RSS feed type';
$string['search'] = 'Search';
$string['searchdatefrom'] = 'Posts must be newer than this';
$string['searchdateto'] = 'Posts must be older than this';
Expand Down
6 changes: 6 additions & 0 deletions mod/forum/mod_form.php
Expand Up @@ -121,6 +121,9 @@ function definition() {
$choices[2] = get_string('posts', 'forum');
$mform->addElement('select', 'rsstype', get_string('rsstype'), $choices);
$mform->addHelpButton('rsstype', 'rsstype', 'forum');
if (isset($CFG->forum_rsstype)) {
$mform->setDefault('rsstype', $CFG->forum_rsstype);
}

$choices = array();
$choices[0] = '0';
Expand All @@ -139,6 +142,9 @@ function definition() {
$mform->addElement('select', 'rssarticles', get_string('rssarticles'), $choices);
$mform->addHelpButton('rssarticles', 'rssarticles', 'forum');
$mform->disabledIf('rssarticles', 'rsstype', 'eq', '0');
if (isset($CFG->forum_rssarticles)) {
$mform->setDefault('rssarticles', $CFG->forum_rssarticles);
}
}

//-------------------------------------------------------------------------------
Expand Down
28 changes: 28 additions & 0 deletions mod/forum/settings.php
Expand Up @@ -104,6 +104,34 @@
$settings->add(new admin_setting_configselect('forum_enablerssfeeds', get_string('enablerssfeeds', 'admin'),
$str, 0, $options));

if (!empty($CFG->enablerssfeeds)) {
$options = array(
0 => get_string('none'),
1 => get_string('discussions', 'forum'),
2 => get_string('posts', 'forum')
);
$settings->add(new admin_setting_configselect('forum_rsstype', get_string('rsstypedefault', 'forum'),
get_string('configrsstypedefault', 'forum'), 0, $options));

$options = array(
0 => '0',
1 => '1',
2 => '2',
3 => '3',
4 => '4',
5 => '5',
10 => '10',
15 => '15',
20 => '20',
25 => '25',
30 => '30',
40 => '40',
50 => '50'
);
$settings->add(new admin_setting_configselect('forum_rssarticles', get_string('rssarticles', 'forum'),
get_string('configrssarticlesdefault', 'forum'), 0, $options));
}

$settings->add(new admin_setting_configcheckbox('forum_enabletimedposts', get_string('timedposts', 'forum'),
get_string('configenabletimedposts', 'forum'), 0));
}
Expand Down

0 comments on commit c9f2d34

Please sign in to comment.