initial work on topic watch feature: users can stop watching it, but there's no way to start watching unwatched topic

This commit is contained in:
Aleksei Miheev
2012-06-01 03:16:48 +04:00
parent b0ca07531a
commit 808df9462d
4 changed files with 52 additions and 2 deletions

View File

@@ -1346,6 +1346,8 @@ function Post2()
$topic = db_insert_id();
if ($topic > 0)
{
// Start watching topic
db_query("INSERT IGNORE {$db_prefix}watch_topics(ID_MEMBER,ID_TOPIC) VALUES($ID_MEMBER,$topic);", __FILE__, __LINE__);
// Fix the message with the topic.
db_query("
UPDATE {$db_prefix}messages
@@ -1390,6 +1392,10 @@ function Post2()
'$user_info[ip]', " . (isset($_POST['ns']) ? '0' : '1') . ", '$_POST[message]', '$_POST[icon]')", __FILE__, __LINE__);
$ID_MSG = db_insert_id();
// If this is the first time user replies in this topic,
// he'll start watching it.
db_query("INSERT IGNORE {$db_prefix}watch_topics(ID_MEMBER,ID_TOPIC) VALUES($ID_MEMBER,$topic);", __FILE__, __LINE__);
if ($ID_MSG > 0)
{
// If attachments were added, update the table now we know the message ID.