Discussions now store the last user to change them, as well as the

last time they were modified.   This isn't actually used yet but it
will be.
This commit is contained in:
moodler 2004-02-06 13:15:15 +00:00
parent 0ad4eb5f63
commit 016cd6af4f
6 changed files with 17 additions and 3 deletions

View File

@ -105,6 +105,10 @@ function forum_upgrade($oldversion) {
table_column("forum_posts", "mailed", "mailed", "tinyint", "2");
}
if ($oldversion < 2004020600) {
table_column("forum_discussions", "", "usermodified", "integer", "10", "unsigned", "0", "", "timemodified");
}
return true;
}

View File

@ -36,6 +36,7 @@ CREATE TABLE prefix_forum_discussions (
groupid int(10) unsigned NOT NULL default '0',
assessed tinyint(1) NOT NULL default '1',
timemodified int(10) unsigned NOT NULL default '0',
usermodified int(10) unsigned NOT NULL default '0',
PRIMARY KEY (id)
) COMMENT='Forums are composed of discussions';
# --------------------------------------------------------

View File

@ -43,6 +43,10 @@ function forum_upgrade($oldversion) {
table_column("forum_discussions", "", "groupid", "integer", "10", "unsigned", "0", "", "userid");
}
if ($oldversion < 2004020600) {
table_column("forum_discussions", "", "usermodified", "integer", "10", "unsigned", "0", "", "timemodified");
}
return true;
}

View File

@ -33,7 +33,8 @@ CREATE TABLE prefix_forum_discussions (
userid integer NOT NULL default '0',
groupid integer NOT NULL default '0',
assessed integer NOT NULL default '1',
timemodified integer NOT NULL default '0'
timemodified integer NOT NULL default '0',
usermodified integer NOT NULL default '0'
);
# --------------------------------------------------------

View File

@ -898,7 +898,8 @@ function forum_get_discussions($forum="0", $forumsort="d.timemodified DESC",
$postdata = "p.*";
}
return get_records_sql("SELECT $postdata, d.timemodified, u.firstname, u.lastname, u.email, u.picture
return get_records_sql("SELECT $postdata, d.timemodified, d.usermodified,
u.firstname, u.lastname, u.email, u.picture
FROM {$CFG->prefix}forum_discussions d,
{$CFG->prefix}forum_posts p,
{$CFG->prefix}user u
@ -1774,6 +1775,7 @@ function forum_add_new_post($post) {
// Update discussion modified date
set_field("forum_discussions", "timemodified", $post->modified, "id", $post->discussion);
set_field("forum_discussions", "usermodified", $post->userid, "id", $post->discussion);
return $post->id;
}
@ -1794,6 +1796,7 @@ function forum_update_post($post) {
// Update discussion modified date
set_field("forum_discussions", "timemodified", $post->modified, "id", $post->discussion);
set_field("forum_discussions", "usermodified", $post->userid, "id", $post->discussion);
return update_record("forum_posts", $post);
}
@ -1835,6 +1838,7 @@ function forum_add_discussion($discussion) {
$discussion->firstpost = $post->id;
$discussion->timemodified = $timenow;
$discussion->usermodified = $post->userid;
if (! $discussion->id = insert_record("forum_discussions", $discussion) ) {
delete_records("forum_posts", "id", $post->id);

View File

@ -5,7 +5,7 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2004013101;
$module->version = 2004020600;
$module->requires = 2004013101; // Requires this Moodle version
$module->cron = 60;