Rock
Rock copied to clipboard
The showwhen parameter default value not working correctly for the Scheduled Content shortcode
Description
The showwhen
parameter of the Scheduled Content shortcode does not appear to be defaulting to the value of live
like the documentation says. It behaves more like the default value is both
.
Actual Behavior
When the showwhen
parameter is omitted, the shortcode output always includes the content even when the specified schedule is not currently live.
Expected Behavior
According to the documentation, the showwhen
parameter should default to live
, which means that the content should not be shown when the specified schedule is not currently active.
Steps to Reproduce
- Find the ID of a schedule that is not currently live.
- Add an HTML block to a page (or go to the Lava tester if installed)
- Paste in the following Lava and change the
scheduleID
to the non-live schedule you found:
{% assign scheduleID = 1 %}
<div><b>showwhen = <em>Blank</em></b></div>
{[ scheduledcontent scheduleid:'{{ scheduleID }}' ]}
IsLive: {{ IsLive }}<br>
OccurrenceEndDateTime: {{ OccurrenceEndDateTime }}<br>
NextOccurrenceDateTime: {{ NextOccurrenceDateTime }}<br>
Schedule: {{ Schedule }}
{[ endscheduledcontent ]}
<br><br>
<div><b>showwhen = live</b></div>
{[ scheduledcontent showwhen:'live' scheduleid:'{{ scheduleID }}' ]}
IsLive: {{ IsLive }}<br>
OccurrenceEndDateTime: {{ OccurrenceEndDateTime }}<br>
NextOccurrenceDateTime: {{ NextOccurrenceDateTime }}<br>
Schedule: {{ Schedule }}
{[ endscheduledcontent ]}
<br><br>
<div><b>showwhen = notlive</b></div>
{[ scheduledcontent showwhen:'notlive' scheduleid:'{{ scheduleID }}' ]}
IsLive: {{ IsLive }}<br>
OccurrenceEndDateTime: {{ OccurrenceEndDateTime }}<br>
NextOccurrenceDateTime: {{ NextOccurrenceDateTime }}<br>
Schedule: {{ Schedule }}
{[ endscheduledcontent ]}
<br><br>
<div><b>showwhen = both</b></div>
{[ scheduledcontent showwhen:'both' scheduleid:'{{ scheduleID }}' ]}
IsLive: {{ IsLive }}<br>
OccurrenceEndDateTime: {{ OccurrenceEndDateTime }}<br>
NextOccurrenceDateTime: {{ NextOccurrenceDateTime }}<br>
Schedule: {{ Schedule }}
{[ endscheduledcontent ]}
- Run the Lava and notice that the content of the first
scheduledcontent
shortcode reference is being displayed even though it should be defaulting to only show the content when the schedule is live.
Issue Confirmation
- [X] Perform a search on the Github Issues to see if your bug or enhancement is already reported.
- [X] Try to reproduce the problem on a fresh install or on the demo site.
Rock Version
16.2 & 16.3
Client Culture Setting
en-US