-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.3] Author Filter Now Supports Deleted Users #45186
base: 5.3-dev
Are you sure you want to change the base?
Conversation
@AdarshSantoria Please delete "Fix #45181 - " from the title. The title say [5.3], but the label is PR-5.2-dev. |
I have tested this item ✅ successfully on 66cd254 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45186. |
Thank you for your feedbacks, @fgsw @brianteeman. |
great work!! |
I have tested this item ✅ successfully on 66cd254 Before PRNo deleted user One deleted user After PROne deleted user Three deleted user This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45186. |
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45186. |
|
||
if (\in_array(0, $authorId)) { | ||
// Remove 0 from array and handle deleted users with OR condition | ||
$authorId = array_filter($authorId, fn ($id) => $id !== 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No extra function needed, array_filter
removes "empty" values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks!
Good work with this PR, really like it, just found a minor thing you probably could fix. |
Pull Request for Issue #45181
Summary of Changes
This PR fixes a bug where filtering articles by Author = None did not return articles created by deleted users. Joomla previously used
created_by = 0
for the "None" filter, but in reality, deleted users leave theircreated_by
values intact in the#__content
table — they just no longer exist in the#__users
table.This fix updates the logic to:
0
(representing "None")created_by NOT IN (SELECT id FROM #__users)
author_id = [0, 42]
, to include both deleted users and existing onesTesting Instructions
Actual result BEFORE applying this Pull Request
created_by = 0
was used incorrectly.Expected result AFTER applying this Pull Request
created_by NOT IN (SELECT id FROM #__users)
for deleted users.Link to documentation
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed