We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19328
    • 433 Posts
    First of all: beautiful new look for the forums!

    I'm trying to only show the latest comments from articles with a specific value checked on a TV. This is needed because I only want to show the latest comments from a certain category (each category of articles is shown on a different domain/context).

    I think the function 'getComments' in core/components/quip/controllers/web/LatestComments.php is the one that needs to be adjusted. I know that's bad practice but for now I don't see another way of fixing this. This will probably be quite difficult because this means yet another table (for the TV's) has to be joined to the quipComment and modResource tables to get the desired comments.

    Before I try this, just to be sure: would there be another (better/easier) way of adding a 'tvFilter' to the QuipLatestComments snippet that I'm not aware of? Thanks!
      • 19328
      • 433 Posts
      It's been months but I'm back at this problem. I'm hoping someone can help me a little. Right now I've got the following idea to only show the latest comments for articles that below to a certain category:

      1) get a list of ID's of articles in the right category (for example get the last 50). I use getResources to do this, and a chunk to display the results like this:

      [[!getResources? &parents=`12` &tvFilters=`category==%blog%`&showHidden=`1` &includeTVs=`1` &tpl=`blogIdsTpl`  &tplLast=`blogIdsTplLast` &limit=`20` & toPlaceholder=`ids`]]


      chunks:
      blogIdsTpl:
      'article-b12-[[+id]]',


      blogIdsTplLast:
      'article-b12-[[+id]]'


      This works so far.

      2) Use this generated list in Rowboat to get the latest comments only for the articles with category 'blog'.

      [[!Rowboat?
         &table=`modxm_quip_comments`
         &tpl=`latest_comments`
         &limit=`10`
         &where=`{"thread:IN":[[[+ids]]]}`
         &debug=`1`
      ]]
      


      This is where it's not working anymore. The debugging information shows no where statement at all, and all the results are returned.

      What's wrong with my where statement, anyone can see a problem?
      NB: when I put in the where statement directly like this, it still doesn't work:

      &where=`{"thread:IN":['article-b12-2240', 'article-b12-2241']}`


      Is this the wrong way of doing it?
      Any advice on how I should handle my problem?

      Thanks for any help!!! [ed. note: michelle84 last edited this post 10 years, 11 months ago.]