Somewhere on your site there is an article that should have been archived weeks ago. Not because anything is wrong with it, but because archiving it was someone's job to remember, and people do not remember. This summer I taught Joomla to do that part itself, and this is how it works.
Joomla’s workflow system already knows how to move an article from Draft to Under Review to Published to Archived. What it has never been able to do is move one without someone clicking the button. Joomla’s scheduler already knows how to run jobs on a timer, every hour, every night, every month. The two simply never were introduced to each other.
That was my Google Summer of Code project. They have now been introduced to each other. Here’s what it looks like, what changed along the way, and how you can try it.
The short version
You can now attach a rule to any workflow transition. The rule decides when that transition should happen on its own, and which articles it applies to. A scheduled task checks every so often for items that are due, moves them, and writes down everything it did, or could not do.
Setting up your first rule
Turn workflows on for articles first, under Content, Articles, Options, Integration.

Open Content, Workflows, pick a workflow and open one of its transitions. There is a new Automation tab.
Switch it on, and choose how it should fire. Either after a delay, counted in minutes, hours, days or months from the moment the article entered that stage, or on a schedule you write as a cron expression if you want something like “every Monday at 6am”.
Select the user the rule runs as. This matters more than it looks. The transition happens as that person, with exactly their permissions, so a rule can never do something the chosen user could not do by hand. If that user loses access tomorrow, the rule stops working tomorrow, which is the behaviour you want.

Save the rule, and you are done. “Move anything sitting in Draft for seven days into Under Review” is now a thing your site does by itself.
Making it precise
A rule that fires on everything in a stage is usually too blunt for a real site. So a rule can carry two separate things, and keeping them separate turned out to be one of the more useful decisions of the summer.
A filter decides which articles the rule applies to. A condition decides whether this is the right moment to fire.
There are eight things you can check: category, tag, the author’s user group, hit count, day of the week, a date, how long the article has been in its current stage, and how long since it was last edited. Each supports the comparisons that make sense for it, so you can say “category is one of News or Sport”, “author is in the Editors group”, “fewer than 50 hits”, or “has been in this stage for more than 14 days”.

By default you just add checks and they all have to match, which covers almost everything people actually want. If you need “either this or that”, or “not this”, there is an Expert Mode option in the Workflow Automation plugin that unlocks grouping and nesting.

There is also a Preview button. Before you save a rule, it lists the articles your filter currently matches.

Three sites, three rules
The small news site that forgets to archive. One rule on the Published to Archived transition, after 30 days. Add a filter of category is News, and your evergreen guides stay where they are while the daily stories tidy themselves up.
The government portal where drafts go quiet. A rule on Draft to Under Review, after 7 days. Add a condition that the day of week is not Saturday or Sunday, so nothing lands in a reviewer’s queue at the weekend. The existing notification plugin emails the outcome.
The holiday content nobody takes down. Tag the seasonal pieces, then one rule on Published to Archived, after 3 days, filtered to that tag. Set it once in November and forget it for good.
None of these takes more than a minute and none of them needs anybody to remember anything afterwards.
Being able to see what it is about to do.
Automation you cannot see is automation you can’t trust. That turned out to be a much bigger part of the work than I expected when I wrote the proposal.
Every workflow has an Upcoming Transitions tab listing what is queued and when each item is due, and there is a site-wide version with filters so you can see everything at once.


Articles carry a small badge in the list showing when the next automated move will take place, and the same information appears in the sidebar when you edit one alongside which move is going to take place. The workflow graph marks which transitions are automated.



When something goes wrong, an Automation Log records what happened and why the item is held back rather than retried endlessly, and you get an email. You should not have to go digging to find out that a rule quietly stopped working.

For developers
The list of checks is not fixed. Two new events let any extension add its own checks to the builder and supply their values, so a third-party component can offer something core knows nothing about and have it appear in the same interface. The project includes a small example plugin that asks an external service a yes-or-no question, both to prove the events work and to show the shape of an integration.
What I learned
Cutting a feature is harder than building one, and usually right. My proposal included per-article scheduled transitions, so you could set a date on one specific article, and support for workflows that loop. Both came out during the summer. Neither was difficult to build, which was rather the problem. Once rules lived on transitions, a second place to set timing would have meant two places to check whenever an article did something unexpected, and loops added a whole category of things that could go wrong for a case nobody had actually asked for.
Most of a feature is not the feature. The original idea, move an item after N days, is maybe a fifth of the finished work. The rest is permissions, filters, failure states, logging, and showing people what is about to happen before it happens. I did not plan for that ratio and it turned out to be a lesson that stuck with me.
A review comment is usually about a principle, not a line. The comment points at one place, but the reviewer is describing something they expect to hold everywhere. Learning to read comments that way, and then go and fix the other four places nobody mentioned, changed how much I got out of each round of review.
The useful instinct in someone else’s codebase is not “how would I write this”. It is "how does this project already write this". Joomla has conventions for everything, and following them is what makes your code reviewable by people who have never seen it before. That is a different skill from writing good code alone, and it is the one I most wanted out of this summer.
Try it, and tell us what breaks
The feature is complete and the pull request to Joomla is open for review: https://github.com/joomla/joomla-cms/pull/48480
A few months ago I had never written a line of Joomla code. Joomla can now move articles through a workflow on its own, and I am hoping it will do that on your site soon.
I’m grateful for the guidance provided by my mentors Tushar Malik and Dileep Adari and of course Benjamin Trenkle for his crucial inputs.

Comments