[5.4] Fix expired articles appearing in frontend category view#46637
[5.4] Fix expired articles appearing in frontend category view#46637RudraHingu001 wants to merge 1 commit into
Conversation
|
@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. |
|
I have tested this item 🔴 unsuccessfully on a9f8d81 I created a category with three articles.
The others are red and disabled.
With this setting. With Yootheme, this is counted as 1 item. 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. |
|
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? |
|
From my perspective yes but thats just my opinion |
@brianteeman From my perspective, too. But the issue was labeled as but by @chmst . |
|
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 |
|
Thanks for the replies. Yootheme correctly says, see the link in the first message in the ticket there, that it's in Joomla. 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? |
|
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!! joomla-cms/components/com_content/src/Model/ArticlesModel.php Lines 512 to 526 in 4e34a7e |
|
@brianteeman Thanks for the response, I will pass this on in the ticket at Yootheme |
|
The count is a different issue and not expired articles appearing in frontend category view |
|
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. |
|
Related Pull Request for the display of the count #44950 |
This is here is absolutely and entirely about the count, the output of the option 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. |
This is about the articles that are inaccessible. So that's correct for that request. But what I mean is just public articles. And the request you're referring to is for Joomla 6. |
|
the confusion is from your previous statements
and a lack of clarity that this was referring to the count displayed in a category list view |
|
I've also added the link to the yootheme ticket in my issue at #46614 It was already mentioned there. |
|
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) |
|
@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. |
|
I can not replicate this in a category blog. Maybe I am missing something? |
|
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 |
|
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. |
|
Reported here #46653 that I tested it successfully |
| $model->setState('params', Factory::getApplication()->getParams()); | ||
| $model->setState('filter.category_id', $category->id); | ||
| $model->setState('filter.published', $this->getState('filter.published')); | ||
| $model->setState('filter.published', 1); |
There was a problem hiding this comment.
This seems to break the possibility to set the published filter in the state.
@HLeithner Is that right? And should this PR be moved to 6.1-dev (if fixed)?
There was a problem hiding this comment.
looks wrong to me tbh, but hadn't a in deep look yet
















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
Fixes #46614