Trying to display only unpublished resources using getResources, but seeing bizarre behavior

I have a working getResources call that displays all “Event” objects in a folder in ascending order by date. It works perfectly. As each individual event object has a preset unpublish date and time, I am attempting to create a slightly modified getResources call that displays only the “past” events in descending order by date.

I hid the call using <!– –> so I could first see if it successfully loaded ONLY the unpublished past events, and it worked: When I viewed the source of my page, I could see that the correct output was being retrieved. So I un-commented the call and saved the page, only to see that it is now displaying ALL the events! If I re-comment out the code, it still displays the correct output, but not if I make it visible. What dark magic is this?

Here’s my first snippet call:

[[!getResources:default=<p><em>There are no events or appearances scheduled at this time.</em></p>?
&parents=5
&depth=0
&limit=0
&showUnpublished=0
&processTVs=1
&includeTVs=1
&includeContent=1
&tpl=eventCalendarTpl
&sortbyTV=eventDateTime
&sortdirTV=ASC
&debug=1
]]

And here is the problematic one:

[[!getResources?
&parents=5
&depth=0
&limit=0
&showUnpublished=1
&where={"published" : false}
&processTVs=1
&includeTVs=1
&includeContent=1
&tpl=eventCalendarTpl
&sortbyTV=eventDateTime
&sortdirTV=DESC
]]

It seems so basic, which is why I’m so confused. I have never witnessed something like this before. (If you visit Events - Carla Kaplan - Writer, Professor, Editor | Official website you can see the live page and view the source to see what I’m talking about.)

Thanks in advance for any advice/insight/help!

Michael

There should be no difference in the processing of the snippets on the server, if a MODX snippet tag is put inside an HTML comment (<!-- [[!getResources? ...]] -->) or not.

So what snippet call suddenly changed the output? The first (published resources) or the second one (unpublished resources)?

If you set &debug=`1` in both snippet calls, does anything change in the SQL queries logged in the error log (when you comment out/uncomment the second snippet call)?

Just a thought but are you logged in to the manager when you are seeing this? What happens if you make one of the calls cached and the other uncached?

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.