Show Future entries mod for CMSMS News Module

Show Future entries mod for CMSMS News Module

I was shocked to discover that there was no way to not sure future entries with the CMSMS News Module unless I used the expiration settings. I did not want to expire news articles, I only want to be able to publish articles in the future and not to display them until their publish date.

The mod was very easy, although I only spent a few minutes looking at it I have probably missed something important. It works though, and solved my immediate problem.

News.module.php

// find 
        
$this->SetParameterType('inline',CLEAN_STRING);
// add after
        
$this->SetParameterType('showfuture',CLEAN_INT); 

action.default.php

// find
$now $db->DbTimeStamp(time());

// add after
if (isset($params['showfuture']) && $params['showfuture'== 0)
{
    $query1 
.= " news_date < ".$now." AND";
    
$query2 .= " news_date < ".$now." AND";

It made sense to me to make the default to not display future articles. You can now use the “showfuture” parameter to disable that functionality and show future articles.

{news pagelimit="3" showfuture="0"// will show all future articles 

Posted on Oct 15, 2009 | ∞ Permalink | Posted in: News & Articles

blog comments powered by Disqus