Commit 50f944c3 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Show number of posts in blog listing

Signed-off-by: default avatarRichard Mansfield <>
parent 6272be7c
......@@ -289,8 +289,11 @@ class ArtefactTypeBlog extends ArtefactType {
public static function get_blog_list($limit, $offset) {
global $USER;
($result = get_records_sql_array("
SELECT * FROM {artefact} WHERE \"owner\" = ? AND artefacttype = 'blog'
ORDER BY title LIMIT ? OFFSET ?", array($USER->get('id'), $limit, $offset)))
SELECT, b.title, b.description, COUNT( AS postcount
FROM {artefact} b LEFT JOIN {artefact} p ON (p.parent = AND p.artefacttype = 'blogpost')
WHERE b.owner = ? AND b.artefacttype = 'blog'
GROUP BY, b.title, b.description
ORDER BY b.title", array($USER->get('id')), $offset, $limit))
|| ($result = array());
$count = (int)get_field('artefact', 'COUNT(*)', 'owner', $USER->get('id'), 'artefacttype', 'blog');
......@@ -13,6 +13,7 @@
<td class="right">
<a href="{$WWWROOT}artefact/blog/view/?id={$blog->id}">{$blog->postcount}</a>
<a href="{$WWWROOT}artefact/blog/settings/?id={$blog->id}" class="btn-settings">{str tag=settings}</a>
<a onClick="confirmdelete({$blog->id});" class="btn-del">{str tag=delete}</a>
<a href="{$WWWROOT}artefact/blog/post.php?blog={$blog->id}" class="btn-add">{str tag=addpost}</a>
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