We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37984
    • 215 Posts
    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:

    <?php

    require_once $modx->getOption('core_path').'components/quip/model/quip/quip.class.php';

    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?

    This question has been answered by designcouch. See the first response.

    [ed. note: designcouch last edited this post 11 years, 1 month ago.]
      Jesse Couch
      MODX Aficionado, Front-End Designer & Developer
      http://www.designcouch.com
      • 37984
      • 215 Posts
      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.

      <?php
      $output = '';
       
      $modx->db->connect();
       
      $sql = $modx->db->query( 'SELECT * FROM `modx_quip_comments` ORDER BY createdon');
       
      $resultArray = $modx->db->makeArray( $sql ); 
       
      foreach($resultArray as $item)
      {
           $output.=$item;
           $params['name']=$item['name'];
           $params['body']=$item['body'];
           $output.=$modx->parseChunk('comment_list_widget', $params, '[[+', ']]');
      }
      return $output;
      ?>
        Jesse Couch
        MODX Aficionado, Front-End Designer & Developer
        http://www.designcouch.com
      • discuss.answer
        • 37984
        • 215 Posts
        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.

          Jesse Couch
          MODX Aficionado, Front-End Designer & Developer
          http://www.designcouch.com