cancel
Showing results for 
Search instead for 
Did you mean: 

CMSTimeRestriction not working on ContentPage

Former Member
0 Kudos

Hi,

I have a problem with adding the CMSTimeRestriction to the page.

I am using version 5.3. We have a CustomContentPage extending the ContentPage type. There is a requirement of putting the Time based restriction to CustomContentPage i..e for a specific period, page should be visible and when time/date expires page should not be available on the site.

For this,

 I have added the the CustomContentPage to the CMSTimeRestriction under the AssignedPageTypes section
 Through CMSCockpit, i opened the page in the edit mode, and added one CMSTimeRestriction instance to the page.

But somehow, this restriction is not getting applied and page is visible on the site.

Regards,

Pankaj

Accepted Solutions (1)

Accepted Solutions (1)

andyfletcher
Active Contributor
0 Kudos

I'm guessing you've still got it selected as the default page. (The defaultPage attribute of AbstractPage)

With a content page it will get the page by label and will always show the first default page even if there are restrictions.

If you want it to not show when the restriction applies the set the defaultPage attribute to false and you'll get a CMSItemNotFoundException instead. Be aware that the page won't show in the cmscockpit with the standard search filter of only showing default pages.

If you want a different page to show when the restriction doesn't match then create another content page with the same label but with defaultPage set to true.

Former Member
0 Kudos

Thanks Andrew, this worked

Answers (0)