aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_posting.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2010-03-02 01:05:39 +0100
committerNils Adermann <naderman@naderman.de>2010-03-02 01:05:39 +0100
commita0b58772175ce7490872356c5050d08bd15b488b (patch)
treef99eb0f4b0984cca5020daf403286370f739f414 /phpBB/includes/functions_posting.php
parent6482e72e7c7b7d6b73cef970197789a2c139f44e (diff)
parenta94c760650a9454d1ac33b30243898eae57f8f4f (diff)
downloadforums-a0b58772175ce7490872356c5050d08bd15b488b.tar
forums-a0b58772175ce7490872356c5050d08bd15b488b.tar.gz
forums-a0b58772175ce7490872356c5050d08bd15b488b.tar.bz2
forums-a0b58772175ce7490872356c5050d08bd15b488b.tar.xz
forums-a0b58772175ce7490872356c5050d08bd15b488b.zip
Merge commit 'release-3.0.4-RC1'
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'])))