aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_posting.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2008-12-03 16:43:20 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2008-12-03 16:43:20 +0000
commitbb5c5adab106ea2fe9a414a62fbb99d63cbc5c1d (patch)
tree49f79d94b097b40d5e728f573473b8c82ed2fa7c /phpBB/includes/functions_posting.php
parentc076becc5ae1428f6988c1d6db8879802617e359 (diff)
downloadforums-bb5c5adab106ea2fe9a414a62fbb99d63cbc5c1d.tar
forums-bb5c5adab106ea2fe9a414a62fbb99d63cbc5c1d.tar.gz
forums-bb5c5adab106ea2fe9a414a62fbb99d63cbc5c1d.tar.bz2
forums-bb5c5adab106ea2fe9a414a62fbb99d63cbc5c1d.tar.xz
forums-bb5c5adab106ea2fe9a414a62fbb99d63cbc5c1d.zip
correctly update last topic/forum information if changing guest usernames through editing posts - Bug #38095
(Changelog follows) git-svn-id: file:///svn/phpbb/trunk@9167 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_posting.php')
-rw-r--r--phpBB/includes/functions_posting.php22
1 files changed, 19 insertions, 3 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 635f6f80c5..b4f6252078 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -2132,10 +2132,20 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
// this post is the latest post in the forum, better update
if ($row['forum_last_post_id'] == $data['post_id'])
{
- if ($post_approved && $row['forum_last_post_subject'] !== $subject)
+ // If post approved and subject changed, or poster is anonymous, we need to update the forum_last* rows
+ if ($post_approved && ($row['forum_last_post_subject'] !== $subject || $data['poster_id'] == ANONYMOUS))
{
- // the only data that can really be changed is the post's subject
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_subject = \'' . $db->sql_escape($subject) . '\'';
+ // the post's subject changed
+ if ($row['forum_last_post_subject'] !== $subject)
+ {
+ $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_subject = \'' . $db->sql_escape($subject) . '\'';
+ }
+
+ // Update the user name if poster is anonymous... just in case an admin changed it
+ if ($data['poster_id'] == ANONYMOUS)
+ {
+ $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape($username) . "'";
+ }
}
else if ($data['post_approved'] !== $post_approved)
{
@@ -2272,6 +2282,12 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
{
// only the subject can be changed from edit
$sql_data[TOPICS_TABLE]['stat'][] = "topic_last_post_subject = '" . $db->sql_escape($subject) . "'";
+
+ // Maybe not only the subject, but also changing anonymous usernames. ;)
+ if ($data['poster_id'] == ANONYMOUS)
+ {
+ $sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_name = '" . $db->sql_escape($username) . "'";
+ }
}
}
else if (!$data['post_approved'] && ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies'])))