Skip to content

Commit

Permalink
New field for user: autosubscribe
Browse files Browse the repository at this point in the history
This sets the default value for on-the-fly forum subscription.
Defaults to on = subscribe.

(Also fixed a bug in postgres7.sql - a missing field for htmleditor!)
  • Loading branch information
moodler committed May 23, 2003
1 parent 4b2b7a7 commit 7f2a3e6
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 3 deletions.
3 changes: 3 additions & 0 deletions lang/en/moodle.php
Expand Up @@ -40,6 +40,9 @@
$string['assigncreators'] = "Assign course creators";
$string['assignteachers'] = "Assign teachers";
$string['authentication'] = "Authentication";
$string['autosubscribe'] = "Forum auto-subscribe";
$string['autosubscribeno'] = "No: don't automatically subscribe me to forums";
$string['autosubscribeyes'] = "Yes: when I post, subscribe me to that forum";
$string['availablecourses'] = "Available Courses";
$string['backup'] = "Backup";
$string['backupdir'] = "backupdata";
Expand Down
4 changes: 4 additions & 0 deletions lib/db/mysql.php
Expand Up @@ -393,6 +393,10 @@ function main_upgrade($oldversion=0) {
print_simple_box("Thanks for upgrading!<p>There are many changes since the last release. Please read the release notes carefully. If you are using CUSTOM themes you will need to edit them. You will also need to check your site's config.php file.", "center", "50%", "$THEME->cellheading", "20", "noticebox");
}

if ($oldversion < 2003052300) {
table_column("user", "", "autosubscribe", "integer", "1", "unsigned", "1", "", "htmleditor");
}

return $result;

}
Expand Down
1 change: 1 addition & 0 deletions lib/db/mysql.sql
Expand Up @@ -200,6 +200,7 @@ CREATE TABLE `prefix_user` (
`mailformat` tinyint(1) unsigned NOT NULL default '1',
`maildisplay` tinyint(2) unsigned NOT NULL default '2',
`htmleditor` tinyint(1) unsigned NOT NULL default '1',
`autosubscribe` tinyint(1) unsigned NOT NULL default '1',
`timemodified` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`),
Expand Down
4 changes: 4 additions & 0 deletions lib/db/postgres7.php
Expand Up @@ -164,6 +164,10 @@ function main_upgrade($oldversion=0) {
print_simple_box("Thanks for upgrading!<p>There are many changes since the last release. Please read the release notes carefully. If you are using CUSTOM themes you will need to edit them. You will also need to check your site's config.php file.", "center", "50%", "$THEME->cellheading", "20", "noticebox");
}

if ($oldversion < 2003052300) {
table_column("user", "", "autosubscribe", "integer", "1", "unsigned", "1", "", "htmleditor");
}

return $result;
}
?>
2 changes: 2 additions & 0 deletions lib/db/postgres7.sql
Expand Up @@ -126,6 +126,8 @@ CREATE TABLE prefix_user (
description text,
mailformat integer NOT NULL default '1',
maildisplay integer NOT NULL default '2',
htmleditor integer NOT NULL default '1',
autosubscribe integer NOT NULL default '1',
timemodified integer NOT NULL default '0',
CONSTRAINT user_username_uk UNIQUE (username)
);
Expand Down
6 changes: 5 additions & 1 deletion mod/forum/post.html
Expand Up @@ -68,9 +68,13 @@
$options[1] = get_string("subscribestop", "forum");
choose_from_menu($options, "unsubscribe", 0, "");
} else {
$default = 0;
if (!empty($USER->autosubscribe)) {
$default = 1;
}
$options[0] = get_string("subscribestop", "forum");
$options[1] = get_string("subscribestart", "forum");
choose_from_menu($options, "subscribe", 0, "");
choose_from_menu($options, "subscribe", $default, "");
}
}
helpbutton("subscription", get_string("subscription", "forum"), "forum");
Expand Down
9 changes: 9 additions & 0 deletions user/edit.html
Expand Up @@ -79,6 +79,15 @@
choose_from_menu ($choices, "mailformat", $user->mailformat, "") ?>
</td>
</tr>
<tr valign=top>
<td><p><?php print_string("autosubscribe") ?>:</td>
<td><?php
unset($choices);
$choices["1"] = get_string("autosubscribeyes");
$choices["0"] = get_string("autosubscribeno");
choose_from_menu ($choices, "autosubscribe", $user->autosubscribe, "") ?>
</td>
</tr>
<?php if ($CFG->htmleditor) { ?>
<tr valign=top>
<td><p><?php print_string("textediting") ?>:</td>
Expand Down
4 changes: 2 additions & 2 deletions version.php
Expand Up @@ -5,9 +5,9 @@
// database to determine whether upgrades should
// be performed (see lib/db/*.php)

$version = 2003052000; // The current version is a date (YYYYMMDDXX)
$version = 2003052300; // The current version is a date (YYYYMMDDXX)

$release = "1.0.9 Beta 1 +"; // User-friendly version number


?>
?>

0 comments on commit 7f2a3e6

Please sign in to comment.