Hey all! Happy Thursday. I am looking to get Quip to output the latest comments in my blog to a widget on my manager dashboard, and am having a bit of trouble getting this to work. I've managed to get the Comment Count working using the following snippet:
if (!isset($scriptProperties['context'])) $scriptProperties['context'] = 'mgr';
$quip = new Quip($modx,$scriptProperties);
return $modx->getCount('quipComment', array('thread' => $scriptProperties['thread']));
Surely retrieving the comments themselves can't be too far beyond this. I'm no wizard when it comes to snippets, so any suggestions would be greatly appreciated.
EDIT: Scratch all the above. It doesn't work at all. It returns a 0 regardless of the amount of comments. I am way over my head here - any thoughts from anyone at all?
[ed. note: designcouch last edited this post 8 years, 6 months ago.]
I seem to be carrying on my own conversation here. I have tried running this snippet in my widget, but it crashes my Dashboard manager page.
$output = '';
$sql = $modx->db->query( 'SELECT * FROM `modx_quip_comments` ORDER BY createdon');
$resultArray = $modx->db->makeArray( $sql );
foreach($resultArray as $item)
$output.=$modx->parseChunk('comment_list_widget', $params, '[[+', ']]');
I guess I may as well close this one out. Community response was surprisingly lacking on this one; better next time, maybe?
My solution was modifying the "LatestComments" snippet included with Quip for use on the backend (along with the accompanying chunks). I also had to create a new directory in core/components/quip/controllers called "mgr" and include a blank PHP file called "header.php" in order to eliminate an error that was springing up.
I've included a screenshot of the end result for you to view.