1770 Posts in 495 Topics by 531 members
Blog Module
SilverStripe Forums » Blog Module » Scheduled Blog Post (future dates)
Discuss the Blog Module.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 1137 Views |
-
Scheduled Blog Post (future dates)

7 May 2010 at 2:01am Last edited: 7 May 2010 2:03am
Seems there was no way of hiding future blog posts, I searched on here, but couldn't find an answer. So for anyone in the future, you need to edit Blog/code/BlogTree.php on line 251 there is BlogEntries(), replace the filter if statement with this:
if ($this->LandingPageFreshness && !$this->request->param('Action')) {
if(defined('DB::USE_ANSI_SQL')) {
$filter = "\"BlogEntry\".\"Date\" < NOW() - INTERVAL " . $this->LandingPageFreshness;
} else {
$filter = "`BlogEntry`.Date < NOW() - INTERVAL " . $this->LandingPageFreshness;
}
} else {
/**** THIS IS THE PART THAT IS CHANGING ****/
if(defined('DB::USE_ANSI_SQL')) {
$filter = "\"BlogEntry\".\"Date\" < NOW()";
} else {
$filter = "`BlogEntry`.Date < NOW()";
}
} -
Re: Scheduled Blog Post (future dates)

30 June 2011 at 4:37am
I'm trying to do this as well, is this still the correct approach to be able to schedule future posts? This post was over a year ago so the code in my file looks different. Below is what shows up in my code, can anyone tell me what I should be modifying?
// only use freshness if no action is present (might be displaying tags or rss)
if ($this->LandingPageFreshness && !$this->request->param('Action')) {
$d = new Zend_Date(SS_Datetime::now()->getValue());
$d->sub($this->LandingPageFreshness);
$date = $d->toString('YYYY-MM-dd');
$filter = "\"BlogEntry\".\"Date\" > '$date'";
} else {
$filter = '';
}
| 1137 Views | ||
|
Page:
1
|
Go to Top |


