plainblack.com
Username Password
search
Bookmark and Share
Subscribe

Summary of recent posts

A summary of recent posts is probably a must have on the front page of community portals. Currently, there are multiple ways of realizing this in WebGUI. One way is by using the "Syndicated Content" asset which can display RSS feeds provided by collaboration systems. Another way is by querying the WebGUI database directly using an SQL report. The third way is to create a shortcut of the collaboration system and customize it.

Way: SQL Report

In order to create your own summary, just follow these instructions:

1. Create an SQL report in the place were you want to have it.

2. Fill in the following SQL query

SELECT ad.title, ad.url, p.username, p.revisionDate, a.createdBy
FROM Post p
JOIN asset a USING (assetId)
JOIN assetData ad USING (assetId, revisionDate)
JOIN Thread t ON p.threadId = t.assetId
JOIN asset ta ON t.assetId = ta.assetId
JOIN asset forum ON ta.parentId = forum.assetId
WHERE forum.parentId = 'HYT3tV2fsm4v4enQuNefbg'
AND ad.groupIdView = '7'
AND a.state = 'published'
AND p.revisionDate = (SELECT MAX(revisionDate) FROM Post WHERE assetId = p.assetId)
AND t.revisionDate = (SELECT MAX(revisionDate) FROM Thread WHERE assetId = t.assetId)
ORDER BY p.revisionDate DESC
LIMIT 8;

It will fetch the last 8 posts from all fores within the message board having id "HYT3tV2fsm4v4enQuNefbg". The query is further restricted to posts that can be viewed by group 7, which is the group id for "Everyone" on my site. If you want more than 8 posts, you may change the number in the LIMIT statement.

3. Create a new template for displaying posts. Usually it is best to copy the default template and replace the rows_loop by something like

<div class="postSummary">
<tmpl_loop rows_loop>
<p>
<a class="contentLink" href="^/;<tmpl_var row.field.url.value>"><tmpl_var row.field.title.value></a>
<span class="legend">
(von <a href="?op=viewProfile;uid=<tmpl_var row.field.createdBy.value>"><tmpl_var row.field.username.value></a>
am ^D("%d.%m.%Y",<tmpl_var row.field.revisionDate.value>);)
</span>
</p>
</tmpl_loop>
</div>

4. Edit the SQL report asset to use the new style template you created.

Done! Go and play with it...

Way: Shortcut

1. Create a Shortcut of Collaboration System in the place where you want to have it.
2. Overwrite Values in Shortcut e.g. Template, Number of Results

 

Tested on WebGUI 7.4.38

Keywords: board forum message posts summary

0dhelsten: "Can't this also be done using a shortcut with an override to a custom template?"
0elnino: "yes, kind of. This method can be used to provide a shortened summary of the post. The template variables allowed do not summarize (ie: shorten) the content."
Search | Most Popular | Recent Changes | Wiki Home
© 2023 Plain Black Corporation | All Rights Reserved