aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2005-01-29 14:46:16 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2005-01-29 14:46:16 +0000
commit0aacc245267d1180ccfe2fcc59ca195d53e10cf3 (patch)
tree490fc5c057057c3a66ae3ca2385a8f9ba365e699 /phpBB/includes
parent261e79c920414f5aaa64a37b21cab67662d0b2ef (diff)
downloadforums-0aacc245267d1180ccfe2fcc59ca195d53e10cf3.tar
forums-0aacc245267d1180ccfe2fcc59ca195d53e10cf3.tar.gz
forums-0aacc245267d1180ccfe2fcc59ca195d53e10cf3.tar.bz2
forums-0aacc245267d1180ccfe2fcc59ca195d53e10cf3.tar.xz
forums-0aacc245267d1180ccfe2fcc59ca195d53e10cf3.zip
fix last_post_information for moderated topics
git-svn-id: file:///svn/phpbb/trunk@5088 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions_posting.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 7aba451285..8e3851e86c 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -97,14 +97,17 @@ function update_last_post_information($type, $id)
$update_sql = array();
- $sql = 'SELECT MAX(post_id) as last_post_id
- FROM ' . POSTS_TABLE . "
- WHERE post_approved = 1
- AND {$type}_id = $id";
+ $sql = 'SELECT MAX(p.post_id) as last_post_id
+ FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t
+ WHERE p.topic_id = t.topic_id
+ AND p.post_approved = 1
+ AND t.topic_approved = 1
+ AND p.{$type}_id = $id";
+
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
- if ($row['last_post_id'])
+ if ((int) $row['last_post_id'])
{
$sql = 'SELECT p.post_id, p.poster_id, p.post_time, u.username, p.post_username
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u