2

I've noticed that articles have very handy Start Publishing and Finish Publishing fields that will automatically (at least how I understand it) published or unpublish articles based entirely off of those two fields. I was wondering if anyone could explain where/how exactly this feature works.

Is there a plugin that checks and updates the articles in the background? Is the article's state updated when fetched by JModelList or JModelItem? Is a MYSQL trigger created that handles it?

I'm really not sure where to look, so I haven't really found anything.

4

Nothing needs to be changed or updated in the background when the Start Publishing or Finish Publishing dates are crossed. Let me explain how it works; I'll try not to be too technical.

When you request a page that loads an article Joomla will get the details about that article from the database. As it gets those details it also checks to see if you're allowed to view that article.

If you're not allowed to view the article then no data is returned and the page displays an error or something (on pages that load multiple article, such as the maybe the homepage, it simply wont show that article).

So what are some things Joomla checks for to see if it should give you access to that article? If you were a normal guest visitor checking a normal article here are some things that would be checked before returning the article's data:

  • Is the article's Status set to "Published"?
    This is the "Published", "Unpublished", "Archived", "Trashed" option you have for articles.

  • Is the article's Access set to "Public"?
    This determines which user groups are allowed to view the article, "Public" means everyone.

  • Is the current date/time greater than the Start Publishing date OR is the Start Publishing date empty ("0000-00-00 00:00:00")?
    So if you visit the site at "2017-09-09 10:36:10" (your Joomla local time) and the Start Publishing date is set to a date less than that date (or the Start Publishing date is "0000-00-00 00:00:00") then the article can be viewed. Otherwise, nope.

  • Is the current date/time less than the Finish Publishing date OR is the Finish Publishing date empty ("0000-00-00 00:00:00")?
    So if you visit the site at "2017-09-09 10:36:10" (your Joomla local time) and the Finish Publishing date is set to a date greater than that date (or the Finish Publishing date is "0000-00-00 00:00:00") then the article can be viewed. Otherwise, nope.

If the article's settings pass all those checks then the article can be displayed to the user. Otherwise, it can't be.

These checks are done (or are supposed to be done) for any page, component, or module that requests article data for display.

So that's why nothing needs to be changed when the Start/Finish Publishing dates are crossed, because checking those dates are part of the process every time an article is retrieved from the database.

Note
One thing that does affect this is caching. If you have caching turned on then articles may become available or unavailable due to the Start/Finish Publishing setting but the cached pages wont show that fact until they expire or are cleared manually. That may result in pages that are live not showing up right away when their Start Publishing date is reached and then may remain on listing pages (such as the homepage or a Category Blog layout page) a little while after they're Finish Publishing date is reached.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.