adding future public date (ie auto-publish post on ____)

Permalink Browser Info Environment
I added the ability to set a future date on a post and have it hide* until then, then auto-appear.

Copy
packages/problog/blocks/problog_list/controller.php
to
blocks/problog_list/controller.php

Around line 75 (after the 'orderBy' switch conditional closes) add this code:
// filter out future posts
$pl->filterByPublicDate(date('Y-m-d H:i:s'), '<=');


Now the post won't appear in any ProBlog list until the "public" date you set in the ProBlog Dashboard add/edit settings.

To be able to see the future-dated page I also copied
packages/problog/blocks/content/blog_post/view.php
to
blocks/content/blog_post/view.php
and commented out the date check around line 22:
// either this for older problog (pre 5.4.1)
if ($c->getCollectionDatePublic() <= date(DATE_APP_GENERIC_MDY) ){
// or, new problog
if (date('Ymd',strtotime($c->getCollectionDatePublic())) <= date('Ymd') ){

Don't forget to comment out the closing brace at the end of that file just above the
<br style="clear:both">


I couldn't think of why there should be a date-check in the content block, so it seemed innocuous to remove it. Please correct me if I'm wrong!

*The Catch
Posts still appear in auto-nav and page-list blocks, and also in your sitemap.xml. The page/post is still part of the CMS, but the problog_list block ignores it. Maybe someone else can improve upon this?

Type: Discussion
Status: New
kirkroberts
View Replies:
RadiantWeb replied on at Permalink Reply
RadiantWeb
you can also simply add an if/else on within the view checking the public date. (wich I ACTUALLY thought was already in there...but after checking, it seems is not).

I like this better though, so if you don't mind, I will add this to the blog_list controller.

for your help, I will be sending you a free license of Quick-links addon.

C
kirkroberts replied on at Permalink Reply
kirkroberts
The issue I ran into is if you use if/else in the view you're messing with the pagination that is set in the controller.

I modded the search feature to use the Problog_list block and am running into that issue. For instance, the controller might return a list of 7 items to show, but depending on the filtering criteria I end up with paginated results that 0 - 7 items on each page :-(

Ideally the block would set the filter criteria (ie category or tag) and pass that to the controller so pagination could be function as expected.

Not expecting you to implement this, I'm just talking through it.

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.