Commit c7a8e432 authored by Dan Poltawski's avatar Dan Poltawski Committed by Penny Leach
Browse files

Forum post totals were not being displayed on mysql (bug 3137)

Mysql returning the field count fields as count(x.id) rather than
simply count
parent cb878e7d
......@@ -63,7 +63,7 @@ $breadcrumbs = array(
);
$forums = get_records_sql_array(
'SELECT f.id, f.title, f.description, m.user AS moderator, COUNT(t.id), s.forum AS subscribed
'SELECT f.id, f.title, f.description, m.user AS moderator, COUNT(t.id) AS topiccount, s.forum AS subscribed
FROM {interaction_instance} f
LEFT JOIN (
SELECT m.forum, m.user
......
......@@ -43,7 +43,7 @@
{/foreach}
{/if}
</td>
<td align="center">{$forum->count}</td>
<td align="center">{$forum->topiccount}</td>
{if $admin}
<td class="nowrap">
<a href="{$WWWROOT}interaction/edit.php?id={$forum->id|escape}&amp;returnto=index" id="btn-edit">{str tag=edit}</a>
......
......@@ -27,7 +27,7 @@
{$topic->poster|display_name|escape}
</a>
</td>
<td class="postscount">{$topic->count|escape}</td>
<td class="postscount">{$topic->postcount|escape}</td>
<td class="lastpost">
{if !$topic->lastpostdeleted}
<a href="{$WWWROOT}user/view.php?id={$topic->lastposter}"
......
......@@ -177,7 +177,7 @@ $forum->subscribe = pieform(array(
// gets the info about topics
// the last post is found by taking the max id of the posts in a topic with the max post time
// taking the max id is needed because multiple posts can have the same post time
$sql = 'SELECT t.id, p1.subject, p1.body, p1.poster, p1.deleted, m.user AS moderator, COUNT(p2.id), t.closed, s.topic AS subscribed, p4.id AS lastpost, ' . db_format_tsfield('p4.ctime', 'lastposttime') . ', p4.poster AS lastposter, m2.user AS lastpostermoderator
$sql = 'SELECT t.id, p1.subject, p1.body, p1.poster, p1.deleted, m.user AS moderator, COUNT(p2.id) AS postcount, t.closed, s.topic AS subscribed, p4.id AS lastpost, ' . db_format_tsfield('p4.ctime', 'lastposttime') . ', p4.poster AS lastposter, m2.user AS lastpostermoderator
FROM {interaction_forum_topic} t
INNER JOIN {interaction_forum_post} p1 ON (p1.topic = t.id AND p1.parent IS NULL)
LEFT JOIN (
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment