Hide notices automatically on a date
For administrators and developers. The kernel's cronjob script hide.php (in the default cronjob part) hides objects of
chosen classes whose date attribute has passed; it does nothing until configured. Hidden notices stay in the tree with
their history and can be revealed (Archiving old notices).
Contents
Before you start
- The class of the notices (for example identifier
notice) and the node id of the folder that holds them. - Rights to edit classes; access to settings.
- The default cronjob part runs on the server (
php runcronjobs.phpfrom the crontab).
Steps
Setup > Classes, edit the notice class, add an attribute of the date (or date and time) datatype with the identifier
hide_date, name "Hide on". Store.In
settings/override/content.ini.append.php:[HideSettings] RootNodeList[] RootNodeList[]=<node id of the notices folder> HideDateAttributeList[] HideDateAttributeList[notice]=hide_dateClear the INI cache.
Tell editors to fill "Hide on" when they publish a notice.
Do not confuse with unpublish.php and [UnpublishSettings], which move objects with a passed unpublish_date to the
trash; for records, hiding is the safer choice.
Check that it worked
- Publish a test notice with a hide date in the past, in a test folder under the configured root.
- Run the default part by hand:
php runcronjobs.php -q, or only the script: the output lists "Hiding node: ...". - The notice shows Hidden in the administration and is gone from the public site; the audit records
content.node.hide.
Related pages
- Archiving old notices
- Hiding content
- Cronjobs
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.