ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Comments returned for all channels on all sites despite specifying the channel parameter

May 15, 2011 2:01pm

Subscribe [3]
  • #1 / May 15, 2011 2:01pm

    buggles

    32 posts

    I want to display recent comments on entries in a single channel on a landing page, but it’s showing all comments (including those from another MSM site)!

    Very simple template:

    {exp:comment:entries sort="desc" channel="archive_discography" limit="10"}
        <div>
            {name} on <a href="http://{comment_url_title_auto_path}">{title}</a>, {comment_date format="%F %j, %Y at %h:%i%a"}<br> 
        </div>
    {/exp:comment:entries}

    Any thoughts on why it’s not working?

  • #2 / May 16, 2011 6:18am

    John Henry Donovan

    12339 posts

    buggles,

    When you say all comments, do you mean your issue if that the limit= parameter is not working.

    To just show a preferred site then use the site=“site_shortname” parameter. Also try using the dynamic=“no” parameter

  • #3 / May 16, 2011 7:35am

    buggles

    32 posts

    No I mean that comments from all channels, on all sites are showing despite the channel selector parameter being supplied. dynamic=“no” makes no difference.

  • #4 / May 17, 2011 10:42am

    Kevin Smith

    4784 posts

    Hey buggles—

    Be on the lookout for an email from me.

    Kevin

  • #5 / May 17, 2011 11:08am

    Kevin Smith

    4784 posts

    Hey buggles—

    What version and build are you running? If it’s 2.1.3 build 20110411, it appears this is a known bug.

    If you’re using 2.1.4 beta, does the code you’re now using in your template look exactly like this (with site-shortname replaced)?

    {exp:comment:entries sort="desc" channel="archive_discography" limit="10" dynamic="no" site="site_shortname"}
        <div>
            {name} on <a href="http://{comment_url_title_auto_path}">{title}</a>, {comment_date format="%F %j, %Y at %h:%i%a"}<br> 
        </div>
    {/exp:comment:entries}

    And you’ve double-checked to make sure the channel name is correct, yes? Let me know where you are on this.

    Kevin

  • #6 / May 17, 2011 12:59pm

    buggles

    32 posts

    I’m on the 2.1.3 build, so it looks like that defect is the problem (was a little concerned with the comment on the bug saying it was a deprecated channel parameter…). The channel name was copied and pasted from the control panel (I’ve been burned by too many typo’s over the years to risk anything else!).

    There is a proposed fix in the defect report, would Ellis labs recommend applying that?

  • #7 / May 18, 2011 2:54am

    John Henry Donovan

    12339 posts

    buggles,

    There is a proposed fix in the defect report, would Ellis labs recommend applying that?

    Please feel free to go ahead and apply it and see if it works for you.

    Note though that the code in the report has not been wrapped in code blocks so make sure to replace all curly quotes with single quotes as below

    if (count($channel_ids) == 1)
    {
      $this->EE->db->where('channel_id', $channel_ids['0']);
    }
    elseif (count($channel_ids) > 1)
    {
      $this->EE->db->where_in('channel_id', $channel_ids);
    }
  • #8 / May 18, 2011 4:28am

    buggles

    32 posts

    That’s worked nicely.

    Thanks for the help… get it nailed in 2.1.4 😉

  • #9 / May 18, 2011 5:48pm

    Brandon Jones

    5500 posts

    Thanks for the update, buggles. Glad that worked for now!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases