Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Blog Module

Discuss the Blog Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Scheduled Blog Post (future dates)


Reply

2 Posts   1444 Views

Avatar
Yellow7 Jon

7 May 2010 at 2:01am (Last edited: 7 May 2010 2:03am), Community Member, 39 Posts

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()";
         }
      }

Avatar
Bstarr

30 June 2011 at 4:37am Community Member, 25 Posts

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 = '';
      }