2017-11-22, 22:49

Feb 27, 2012 — Notify Users module, ver. 0.5 released — user can choose between sending single message (...) »

2013-01-28, 08:32

19 студзеня 2013 у Гродне трагічна загінуў паэт, журналіст і мой сябар (...) »

2009-10-14, 07:19

The site Litaratura.org is devoted to Belarusian literary works and translations. (...) »

2009-01-12, 20:46

Late November 2008 marked the 20th anniversary of the official founding of the Belarusian (...) »

Registered User Area Log into This Site
Show Credits... Credits
Worthwhile Services
Refresh My Local Time (GMT+1)... Nov 22, 2017 — 22:49
  • France (1)
    Russian Federation (1)
    United States (1)
    __unresolved (1)
  • Today (397)
  • Yesterday (454)
~ / Public Domain Software / LatestComments Snippet $_
LatestComments Snippet
Click To View A Full Size Image...
2010-04-03, 06:23

LatestComments snippet allows to obtain comments from the global scope of your MODx-driven site. Comments are descendingly ordered by a creation date.

Solving this task with the means given by Jot itself is neither obvious nor easy. Several threads on MODx forum where posters banged their heads against the brick wall serve for an evidence.

How to use LatestComments

# 1) create new snippet 'LatestComments' and paste into it content of the attached latestcomments.txt file
# 2) call your snippet something as:
[[LatestComments? &count=`5` &customFields=`name,email` &tplComment=`comment-chunk`]]
# 3) please read more details on parameters/ placeholders in snippet's header

Simple fetching items from Jot’s table in a MODx database cannot solve the issue of latest comments. The fetched info should also be correlated with a status of documents that the comments are attached to – documents may be in different states: published, unpublished, deleted.

There is also another problem — very often designers want to have along with latest comments also brief info on documents that the comments belong to.

I have tried to solve in my snippet all these most common issues. The snippet initially has been posted to this thread on MODx forum.

Download This Attachment... LatestComments Snippet — the very latest version
Last modified: 2011-06-18, 00:00 — Size: 7,21 KB — Users: 519 — Downloads: 1 458
Click to show a form...Click to hide the form... Write a comment
  • Required fields are marked with *.
  • Comments are published after the approval of the site owner, who is a human rather than a wind-fast computer program so please be patient.

* Code:
 
Get another image...Enter this code into the appropriate field of the form while submitting an e-mail or a comment. If you have trouble with reading it, generate another...
labanino
Comment
Limiting number of characters on
Comment #1 on: 2010-11-07, 23:02
Hey, Greate snippet! I just want to control the number of characters to be displayed in . Any help? Thanks.
Aleksander Maksymiuk
Comment
Re: Limiting number of characters on
Comment #2 on: 2010-12-13, 23:41
This issue has been resolved in Oct 30 update.
ao
Comment
createdby/poster from WebUser
Comment #3 on: 2011-06-17, 11:30
I made a little bit modification to the code to correct placeholder when the poster is a WebUser.

--- latestcomments.txt.orig 2010-10-30 16:27:00.000000000 0900
latestcomments.txt 2011-06-17 18:26:34.000000000 0900
@@ -83,7 83,8 @@
$siteContent = $modx->getFullTableName('site_content');
$GLOBALS['siteContent'] = $siteContent;
# get Jot custom fields
-$jcf = explode(',', $customFields);
$jcf = explode(',', $posterField . ',' . $customFields);
$jcf = array_unique($jcf);
# build subqueries
$subqueries = '';
foreach ($jcf as $field) {
@@ -120,9 121,17 @@
if (($result = mysql_query($query)) && mysql_num_rows($result)) {
while ($row = mysql_fetch_assoc($result)) {
if ($row['createdby']) {
if ($row['createdby'] < 0) {
$info = $modx->getWebUserInfo(-($row['createdby']));
} else {
$info = $modx->getUserInfo($row['createdby']);
}
if ($info['fullname'] == '') {
$row['createdby'] = $info['username'];
} else {
$row['createdby'] = $info['fullname'];
- $row['jcf_' . $posterField] = $info['fullname'];
}
$row['jcf_' . $posterField] = $row['createdby'];
} else {
$row['createdby'] = $row['jcf_' . $posterField];
}
Aleksander Maksymiuk
Comment
Re: createdby/poster from WebUser
Comment #4 on: 2011-06-18, 11:36
Excellent observation. Thank you, "ao". I've updated code of the snippet, however, I formulated your remarks in more concise way.
Pavel
Comment
Re: LatestComments Snippet
Comment #5 on: 2013-02-13, 09:45
Many thanks to you for the help
Dimkas
Comment
Thanks
Comment #6 on: 2014-02-12, 14:10
Thanks!:)