aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_posting.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2008-12-03 16:40:53 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2008-12-03 16:40:53 +0000
commit88ddcceb3bf8c15fee9c9bf0aee090bd9cab3fec (patch)
treee9e3697184b89b19725489c3d47760be998d4337 /phpBB/includes/functions_posting.php
parent951a83546d9058f1bcff0c05a31932b1a765707f (diff)
downloadforums-88ddcceb3bf8c15fee9c9bf0aee090bd9cab3fec.tar
forums-88ddcceb3bf8c15fee9c9bf0aee090bd9cab3fec.tar.gz
forums-88ddcceb3bf8c15fee9c9bf0aee090bd9cab3fec.tar.bz2
forums-88ddcceb3bf8c15fee9c9bf0aee090bd9cab3fec.tar.xz
forums-88ddcceb3bf8c15fee9c9bf0aee090bd9cab3fec.zip
correctly update last topic/forum information if changing guest usernames through editing posts - Bug #38095
(Changelog follows) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9166 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 030ce72d7c..4d96fb9537 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -2137,10 +2137,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)
{
@@ -2277,6 +2287,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'])))