From 7f2a3e678e1d8a1eaaf6b497ad4f2c89417f356d Mon Sep 17 00:00:00 2001 From: moodler Date: Fri, 23 May 2003 05:32:40 +0000 Subject: [PATCH] New field for user: autosubscribe 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!) --- lang/en/moodle.php | 3 +++ lib/db/mysql.php | 4 ++++ lib/db/mysql.sql | 1 + lib/db/postgres7.php | 4 ++++ lib/db/postgres7.sql | 2 ++ mod/forum/post.html | 6 +++++- user/edit.html | 9 +++++++++ version.php | 4 ++-- 8 files changed, 30 insertions(+), 3 deletions(-) diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 1b185754d72..de0e2e67818 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -40,6 +40,9 @@ $string['assignadmins'] = "Assign admins"; $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"; diff --git a/lib/db/mysql.php b/lib/db/mysql.php index 2d95ee664b1..7b122ac3be1 100644 --- a/lib/db/mysql.php +++ b/lib/db/mysql.php @@ -393,6 +393,10 @@ function main_upgrade($oldversion=0) { print_simple_box("Thanks for upgrading!

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; } diff --git a/lib/db/mysql.sql b/lib/db/mysql.sql index 82302af4cc6..c34cfed9007 100644 --- a/lib/db/mysql.sql +++ b/lib/db/mysql.sql @@ -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`), diff --git a/lib/db/postgres7.php b/lib/db/postgres7.php index 8096f517bde..1654ac5c993 100644 --- a/lib/db/postgres7.php +++ b/lib/db/postgres7.php @@ -164,6 +164,10 @@ function main_upgrade($oldversion=0) { print_simple_box("Thanks for upgrading!

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; } ?> diff --git a/lib/db/postgres7.sql b/lib/db/postgres7.sql index 6a8e5fd50fb..feeb4760b73 100644 --- a/lib/db/postgres7.sql +++ b/lib/db/postgres7.sql @@ -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) ); diff --git a/mod/forum/post.html b/mod/forum/post.html index b8b16d07353..7b9b987e6e6 100644 --- a/mod/forum/post.html +++ b/mod/forum/post.html @@ -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"); diff --git a/user/edit.html b/user/edit.html index 5d1c9f6e4e2..aa2d421069f 100644 --- a/user/edit.html +++ b/user/edit.html @@ -79,6 +79,15 @@ if (isadmin()) { choose_from_menu ($choices, "mailformat", $user->mailformat, "") ?> + +

: + autosubscribe, "") ?> + + htmleditor) { ?>

: diff --git a/version.php b/version.php index 54eb651aa06..a3070d746f5 100644 --- a/version.php +++ b/version.php @@ -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 -?> \ No newline at end of file +?>