Hide pages created with a date in the future

Permalink 1 user found helpful
Hi,

I'm creating a news section and I want to hide any pages created with a Public Date/Time set in the future (so that news stories can be created ahead of time).

I'm using the command getCollectionDatePublic to fetch the date, but I need to compare this date with the current date to ascertain whether the news item should be shown or not.

Any ideas how to do this?

Thanks in advance,
Tony.

 
frz replied on at Permalink Reply
frz
turn advanced permissions on
look for a drop down at the page level that contains:
page permissions
sub page permissions
timed release settings

timed release is what you want. you can define which groups/users see this page from what start date to end date.
Fluvius replied on at Permalink Reply
Hi Franz,

Thanks for your help.

Am I right in thinking that for every news item page that the client creates they would have to set up the timed release settings for that page?

The solution I was thinking of involved adding some code to my custom page_list template within the loop:
for ($i = 0; $i < count($cArray); $i++ ) {
$cobj = $cArray[$i]; ?>

that compares the getCollectionDatePublic value to the current date and only displays that news page's details if the getCollectionDatePublic value is either today's date or sometime in the past.

The problem is that my PHP coding skills are minimal, so I'm not sure how to code this solution.

Thanks again for your help.
Tony.
billthornton replied on at Permalink Reply
Why doesn't the Public Display function suppress the pages on the site from displaying, or am I not fully understanding what that field is there for?
frz replied on at Permalink Reply
frz
its just a date. if you want to do timed page releases, turn on advanced permissions.
oblocutor replied on at Permalink Reply
oblocutor
Sorry to dredge up an old thread, but I wanted to add in some findings for future searchers.

I have an RSS feed based on a custom page controller per Andrew Embler's instructions (http://andrewembler.com/concrete5/building-a-custom-rss-feed/... ) and wanted to have the Public Date/Time control when items were published to the feed. Like the OP, I didn't want to have items with a future date to be shown. Here's how I accomplished it.

//Instantiate date helper
$date = Loader::helper('date');
//Query date helper for current time
$r = $date->getLocalDateTime();
// Generate a Page List
$pl = new PageList();
//Exclude pages with future publication dates
$pl->filterByPublicDate($r, $comparison = '<=');


I'm not sure how user time zones are handled in relation to the server's time zone, as it's not a priority for my application. But I can create a page, schedule its public date/time via Page Properties, and have the RSS feed controller automatically add it to the feed at the scheduled time... which is all that I need. :-)

This can be used in combination with advanced permissions.
codaone replied on at Permalink Reply
codaone
I've been fighting with this lack of easy timed release from the beginning I started using concrete5. Now I got it packed to easier use without advanced permissions. It can be found in marketplace
https://www.concrete5.org/marketplace/addons/page-timer/...
With this you can also set timed page unpublishing.