Pending

User tests: Successful: Unsuccessful:

avatar RudraHingu001
RudraHingu001
7 Jan 2026

Pull Request for Issue #46614

Summary

Fixes an issue where expired articles were displayed in frontend category views.

Problem

Frontend category listings did not apply publish date constraints, allowing
expired articles to appear and affect article counts.

Solution

Enforced publish date filtering when retrieving articles in the category model.

Result

  • Expired articles are no longer shown
  • Correct article counts in category listings

Fixes #46614

avatar RudraHingu001 RudraHingu001 - open - 7 Jan 2026
avatar RudraHingu001 RudraHingu001 - change - 7 Jan 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 7 Jan 2026
Category Front End com_content
avatar richard67 richard67 - change - 7 Jan 2026
The description was changed
avatar richard67 richard67 - edited - 7 Jan 2026
avatar richard67
richard67 - comment - 7 Jan 2026

@RudraHingu001 When creating a pull request please stick with our pull request template, which suggests the reference to the issue to be in the first line (I have just fixed that for youz) and which provides headings for testing instructions and for checkboxes if documentation is required or not.

avatar richard67 richard67 - change - 7 Jan 2026
Title
Fix expired articles appearing in frontend category view
[5.4] Fix expired articles appearing in frontend category view
avatar richard67 richard67 - edited - 7 Jan 2026
avatar webmasterab webmasterab - test_item - 7 Jan 2026 - Tested unsuccessfully
avatar webmasterab
webmasterab - comment - 7 Jan 2026

I have tested this item 🔴 unsuccessfully on a9f8d81

I applied the patch to my site using the Yootheme template.
pullrequest

I created a category with three articles.
One is expired; it's displayed in the category overview as green with "1" as published, which is incorrect.
categorie
artikelen

yootheme1

The others are red and disabled.
They don't count.

categorie

With this setting.
1 item expired.
You'll see this message on a basic template.

With Yootheme, this is counted as 1 item.
And it shouldn't be.
An expired item shouldn't be counted.
cassiopeia

It appears that an article in an expired category is still counted as a published article.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46637.

avatar brianteeman
brianteeman - comment - 7 Jan 2026

An expired article is still published. The state of an article does not change when the publish date is either in the future or in the past

avatar richard67
richard67 - comment - 7 Jan 2026

An expired article is still published. The state of an article does not change when the publish date is either in the future or in the past

@brianteeman Does that mean that this PR is wrong, and the referenced issue #46614 should have been closed as expected behavior?

avatar brianteeman
brianteeman - comment - 7 Jan 2026

From my perspective yes but thats just my opinion

avatar richard67
richard67 - comment - 7 Jan 2026

From my perspective yes but thats just my opinion

@brianteeman From my perspective, too. But the issue was labeled as but by @chmst .

avatar brianteeman
brianteeman - comment - 7 Jan 2026

If you use core joomla content and test a blog category layout then it correctly counts the number of visible (puublished and current) articles. I have never used anything from yootheme and nor will I ever use anything from yootheme but if yootheme is not counting correctly then its because they are not counting correctly

avatar webmasterab
webmasterab - comment - 8 Jan 2026

Thanks for the replies.

Yootheme correctly says, see the link in the first message in the ticket there, that it's in Joomla.
https://yootheme.com/support/question/172237#answer-561640
Yootheme's ticket also refers to this closed pull #40172

It's also strange that an expired article is counted.

But as I understand it from the replies, this is 'normal' Joomla behavior.

How does Joomla check this and calculate that there are no articles in Cassiopea?
It indicates that there are no articles if there is one expired article.
Is this handled in Cassiopea's own code?

avatar brianteeman
brianteeman - comment - 8 Jan 2026

No it is nothing to do with cassiopeia it is in the model for the content component which clearly yootheme ignores. yootheme is NOT just a template it does its own thing regarding selecting content and clearly it is wrong/incomplete!!

// Filter by start and end dates.
if (
!(is_numeric($condition) && $condition == ContentComponent::CONDITION_UNPUBLISHED)
&& !(\is_array($condition) && \in_array(ContentComponent::CONDITION_UNPUBLISHED, $condition))
) {
$query->where(
[
'(' . $db->quoteName('a.publish_up') . ' IS NULL OR ' . $db->quoteName('a.publish_up') . ' <= :publishUp)',
'(' . $db->quoteName('a.publish_down') . ' IS NULL OR ' . $db->quoteName('a.publish_down') . ' >= :publishDown)',
]
)
->bind(':publishUp', $nowDate)
->bind(':publishDown', $nowDate);
}

avatar webmasterab
webmasterab - comment - 8 Jan 2026

@brianteeman Thanks for the response, I will pass this on in the ticket at Yootheme

avatar michaelmaass
michaelmaass - comment - 8 Jan 2026

@webmasterab

I installed a plain vanilla Joomla 6.0.2, installed sample content, created a parent category, moved the sample content categories into that. Then I set the "Finish Publishing" date of 2 of the "Blog" category's articles to a date in the past (but left them at Status: Published), set 1 of the 4 articles to Status: Unpublished.

With "Cassiopeia" a "Category List" menu item for the parent category, set to # Articles in Category: Show displays the count 3 in the public frontend.

article-count-cassiopeia-category-list-menu-item

Then I installed YOOtheme Pro, used Dynamic Content, and mapped a field to the "Blog" category's "Article Count". In the preview and in a private/incognito window the count was also 3.

article-count-yootheme-pro-dynamic-content

As far as I can see the count is fully consistent regardless of the template, and — in my test — the very same "3" in Cassiopeia and in YOOtheme Pro.

At the same time, the native count of 3 seems wrong to me because a public user in the frontend gets the information that there are 3 articles but will never see those that are past their "Finish Publishing" date. Technically, it might be accurate that there are 3 articles with the status "Published".

avatar brianteeman
brianteeman - comment - 8 Jan 2026

The count is a different issue and not expired articles appearing in frontend category view

avatar webmasterab
webmasterab - comment - 8 Jan 2026

But it's precisely the counting that matters.

Because an expired item is counted, the feature doesn't work in Yootheme.

Yootheme then sees one item listed even though it's expired and no longer visible to one user.

The counting is the problem.

avatar brianteeman
brianteeman - comment - 8 Jan 2026

Related Pull Request for the display of the count #44950

avatar michaelmaass
michaelmaass - comment - 8 Jan 2026

@brianteeman The count is a different issue and not expired articles appearing in frontend category view

This is here is absolutely and entirely about the count, the output of the option # Articles in Categoryin the frontend.

It is not about whether or not articles appears in the frontend.

Without testing it, you wrote that YOOtheme Pro displays the wrong count. I tested it and could not confirm it. The number is the same in Cassiopeia and YOOtheme Pro.

avatar webmasterab
webmasterab - comment - 8 Jan 2026

Related Pull Request for the display of the count #44950

This is about the articles that are inaccessible.

So that's correct for that request.

But what I mean is just public articles.
But then one has expired, and that one is still counted.

And the request you're referring to is for Joomla 6.
And I'm still running 5.4.

avatar webmasterab
webmasterab - comment - 8 Jan 2026

I've now created a category with one expired and one disabled item.
I think that should be zero items.
y001
However, the counter says this
y002
At Yootheme it also counts 1
y003
And then this option doesn't work.
Because it keeps counting the 1 of the expired item.
y004

avatar brianteeman
brianteeman - comment - 8 Jan 2026

the confusion is from your previous statements

The articles in the backend are counted correctly, for example, 2 published and 2 unpublished.
In the frontend, 4 are counted, which is incorrect.

and a lack of clarity that this was referring to the count displayed in a category list view

avatar webmasterab
webmasterab - comment - 8 Jan 2026

I've also added the link to the yootheme ticket in my issue at #46614

It was already mentioned there.
It's good that it's clear now and we know where to look.
But I don't know much about Joomla code.
Is it possible to adjust the count?

avatar brianteeman
brianteeman - comment - 9 Jan 2026

#40172 (comment)

For core joomla it can be worked around by chosing not to display the article count in the front end list view

However that will not help you in yootheme as from your screenshots (i've never use yootheme nor will i ever) the count is being used as a condition in the admin. As far as I am concerned the correct fix for yootheme is to update the yootheme code so that it correctly takes into account the publish_up/down fields in the same way that the core of joomla already does when counting the articles in the blog category view (as i have shared previously)

avatar janschoenherr
janschoenherr - comment - 9 Jan 2026

@brianteeman The code you quoted here (#46637 (comment)) has nothing todo with the category item count, but instead it filters the articles that are shown. The wrong article count can be replicated on the Category Blog layout in Joomla core.

That being said, I don't think this PR fixes the item count issue. As you pointed out, this would have to be fixed in a similar fashion as #44950.

But again, the issue has nothing to do with YOOtheme Pro and can be replicated in Joomla core.

avatar brianteeman
brianteeman - comment - 9 Jan 2026

I can not replicate this in a category blog. Maybe I am missing something?

avatar janschoenherr
janschoenherr - comment - 9 Jan 2026

With Cassiopeia as theme.

Steps to reproduce the issue:

  • Create a category and a subcategory.
  • Assign two articles to the subcategory. Set one to be expired.
  • Create a menu item of type Article > Category Blog to point to the parent category.
  • In the Articles > Category configuration set # Articles in Category to show

If you go to that menu item in the frontend it will show the Article Count of 2 for the subcategory. If you then go to that subcategory, you'll see 1 article.

Bildschirmfoto 2026-01-09 um 14 52 07 Bildschirmfoto 2026-01-09 um 14 52 21
avatar brianteeman
brianteeman - comment - 9 Jan 2026

ah - that;s the same count as seen in the list view. My point was that the DISPLAY of articles was correct it is just the DISPLAY of the count that is incorrect and I stand 100% behind my previous comments

avatar janschoenherr
janschoenherr - comment - 9 Jan 2026

Yes, this PR references the Issue #46614 about the DISPLAY of the article count, which it does not seem to fix, as far as I can tell.

avatar RudraHingu001
RudraHingu001 - comment - 9 Jan 2026

Hi all,

I’ve opened a new PR that fixes the category article count issue by excluding
expired articles (respecting publish_up / publish_down dates).

PR: #46653
Fixes: #46614

The issue has been tested on Joomla 5.4 with the Cassiopeia template and
category menu item showing article counts.

Please let me know if a review is needed or if any adjustments are required.
Thanks!
image
image

avatar webmasterab
webmasterab - comment - 9 Jan 2026

Reported here #46653 that I tested it successfully

Add a Comment

Login with GitHub to post a comment