Commit aee07961 authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files

Show latest forum posts on the group homepage.

parent 2106da31
......@@ -51,12 +51,34 @@ $offset = param_integer('offset', 0);
$limit = param_integer('limit', 5);
list($html, $pagination, $count, $offset) = group_get_membersearch_data($id, $query, $offset, $limit);
// Latest forums posts
// NOTE: it would be nicer if there was some generic way to get information
// from any installed interaction. But the only interaction plugin is forum,
// and group info pages might be replaced with views anyway...
$foruminfo = get_records_sql_array('
SELECT
p.id, p.subject, p.body, p.poster, p.topic, t.forum, pt.subject AS topicname
FROM
{interaction_forum_post} p
INNER JOIN {interaction_forum_topic} t ON (t.id = p.topic)
INNER JOIN {interaction_instance} i ON (i.id = t.forum)
INNER JOIN {interaction_forum_post} pt ON (pt.topic = p.topic AND pt.parent IS NULL)
WHERE
i.group = ?
AND i.deleted = 0
AND t.deleted = 0
AND p.deleted = 0
ORDER BY
p.ctime DESC
LIMIT 5;
', array($id));
$smarty = smarty(array('paginator', 'groupmembersearch'), array(), array(), array('sideblocks' => array(interaction_sideblock($id, $role))));
$smarty->assign('group', $group);
$smarty->assign('query', $query);
$smarty->assign('results', $html);
$smarty->assign('pagination', $pagination['html']);
$smarty->assign('pagination_js', $pagination['javascript']);
$smarty->assign('foruminfo', $foruminfo);
$smarty->display('group/view.tpl');
?>
......@@ -42,17 +42,15 @@
</form>
</td>
<td>
<h3>Latest Forum Posts</h3>
<table>
<tr>
<th>Thread/Thread Starter</th>
<th>Latest Post</th>
</tr>
<tr>
<td><a href="">Whatever</a><br><a href="">Mike</a></td>
<td>This is some content of some post...</td>
</tr>
</table>
<h3>{str tag=latestforumposts section=group}</h3>
{foreach from=$foruminfo item=postinfo}
<div>
<h4><a href="{$WWWROOT}interaction/forum/topic.php?id={$postinfo->topic|escape}#post{$postinfo->id|escape}">{$postinfo->topicname|escape}</a></h4>
<div><a href="{$WWWROOT}user/view.php?id={$postinfo->poster|escape}">{$postinfo->poster|display_name|escape}</a></div>
<p>{$postinfo->body|str_shorten:100:true}</p>
</div>
{/foreach}
<p><a href="{$WWWROOT}interaction/forum/?group={$group->id|escape}">{str tag=gotoforums} &raquo;</a></p>
</td>
</tr>
</table>
......
Markdown is supported
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