We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5532
    • 251 Posts
    Hi There,

    I have some test comments showing up in my sidebar for documents that no longer exist - I’ve been through the entire site. Are the comments stored in a separate database table from the pages maybe?

    Does anyone know how to sort this out?

    Cheers

      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: cms at Mar 12, 2010, 09:51 PM

      I have some test comments showing up in my sidebar for documents that no longer exist - I’ve been through the entire site. Are the comments stored in a separate database table from the pages maybe?
      That depends on what you used for commenting, what version of MODx you are using, etc. etc. Please provide enough information for us to help you. If this is for the Jot component in MODx 1.0.2, perhaps you can post your question in the appropriate section of the forum.
        • 5532
        • 251 Posts
        HI There OPen Geek, thanks for the reply.

        I’m using Evolution 1.02 and I’m using this snippet to display the latest comments in the sidebar (from the forums here: http://modxcms.com/forums/index.php/topic,36202.msg267590.html#msg267590):
        <?php
        /* scheme for LatestComments snippet */
        
        $count = 3; // how many latest comments
        // use this for fetching comments and poster name
        $query = "SELECT ssb_jot_content.*, ssb_jot_fields.content AS name " .
            "FROM ssb_jot_content " .
            "INNER JOIN ssb_jot_fields " .
                "ON ssb_jot_content.id = ssb_jot_fields.id " .
            "WHERE ssb_jot_content.published = '1' AND ssb_jot_fields.label = 'name' " .
            "ORDER BY ssb_jot_content.createdon DESC " .
            "LIMIT 0, " . $count;
        $results = mysql_query($query);
        // instead of this
        // $results = $modx->db->select('uparent,title,content,createdon', 'ssb_jot_content', 'published=1', 'createdon DESC', $count);
        // render output
        $output = '';
        while ($row = mysql_fetch_array($results, MYSQL_ASSOC)) {
        
          // now use $row['uparent'], $row['title'], $row['content'], $row['createdon']
          // for building your list of latest comments
          // $row['uparent'] -> id of the doc that the comment is attached to
          // $row['title'] -> comment's title
          // ...
          // now you can use also $row['name'] for inserting poster
        
          // for example, comment's title as a link to its article
          $output .= '<div class="jot-user">' . $row['name'] . ' Says:</div><div class="jot-message"><a href="[~' . $row['uparent'] . '~]">"' . $row['content'] . '"</a></div>';
        
        }
        return $output;
        ?>


        Thanks for the reply - sorry I just did a cut and paste of the snippet code as I don’t really understand PHP.
          • 22303 MODX Staff
          • 10,725 Posts
          Quote from: cms at Mar 13, 2010, 12:28 PM

          I’m using Evolution 1.02 and I’m using this snippet to display the latest comments in the sidebar (from the forums here: http://modxcms.com/forums/index.php/topic,36202.msg267590.html#msg267590)

          Thanks for the reply - sorry I just did a cut and paste of the snippet code as I don’t really understand PHP.
          I would suggest posting in that original thread then, so the original author might be able to assist?