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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Scheduling Content w/ addons combination


Go to End


2 Posts   1079 Views

Avatar
nzstephenf

Community Member, 63 Posts

10 July 2015 at 2:01am

Hey everybody,
I have a project running 3.1.12 with the better buttons module from UncleCheese, the SilverStripe catalog manager module from LittleGiant and the Silverstripe/EmbargoExpiry module. These modules are used to provide ease in managing content on my current project.

In order to manage thousands of articles, all article pages are managed in a ModelAdmin (at the time of making this post, it's now CatalogPageAdmin) and not the main "Pages" section of the CMS. My main issue is that I'm unable to save the article page with the embargo/expiry to take effect. No cron job is created.

The embargo/expiry functions work fine in the normal "Pages" section/environment but doesn't work at all outside of that area.

With the functions made possible via. Better buttons, on the setup of a new article page or editing an article page. You have SAVE (obviously as draft) and SAVE & PUBLISH. "Save" an article but not publish the article will publish the article live regardless. So upon saving, no matter what.. Content that needs to be date sensitive will just publish even though it's needed to be scheduled for a later date.

I've tried the soft scheduler module, but this isn't an ideal solution in my situation.

Any tips on how to get embargo/expiry working outside of the "Pages" section of the admin?

Cheers,
Stephen

Avatar
Nightjar

Community Member, 28 Posts

10 July 2015 at 9:28pm

Edited: 10/07/2015 9:29pm

I think something like this can be achieved without a cronjob via permissions.

Try overriding canView() in some way like:

public function canView($memeber=null) {
	return parent::canView($member)
	       && $this->Embargo > SS_DateTime::now()
	       && $this->Expiry < SS_DateTime::now();
}

That's probably not going to work (datetime comes over as a string iirc), but something along those lines should work (like converting the dates to PHP's inbuilt DateTime classes to do actual comparisons with).