User tests: Successful: Unsuccessful:
Pull Request for Issue # .
This PR replaces the use of the deprecated getUser with getIdentity
Create an admin module to display the most popular articles
Test with the author filters
identical
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
Status | New | ⇒ | Pending |
Category | ⇒ | Modules Administration |
Labels |
Added:
PR-6.0-dev
|
I have tested this item ✅ successfully on 09114bb
Status | Pending | ⇒ | Ready to Commit |
RTC
Labels |
Added:
RTC
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2025-07-30 09:01:01 |
Closed_By | ⇒ | softforge |
Thanks for another user centered fix
Just to be clear right from the start, there is nothing wrong with this PR. It was done in the way we documented, it should be done.
That's said, there are better ways. What we want is to reduce the use of static code and super globals, replacing Factory::getUser() with Factory::getApplication->getIdentity() brings us not so much nearer to the goal. The current mod_popular is done in an old way not using a dispatcher and having a static helper class to get the information.
Our dispatcher class has the application object automatically injected and so we don't need the Factory::getApplication part. Instead we can use $this->getApplication()->getIdentity(). This is much better, also more complicated but better in the long run.
#45808 is an example how to do it.
Why I am saying all of this. We discussed the change in the maintainers meeting and decided to merge the currently open replacement getUser PRs but we also want to show how to do better. A module build with a dispachter has the application object injected, so the way is to convert the module code to use a dispacher. Same for plugins, events and views, these classes have also the application injected.
Just to be clear right from the start, there is nothing wrong with this PR. It was done in the way we documented, it should be done.
will you be updating the documentation?
will you be updating the documentation?
I really would like to do it, but we trigger the message in the getUser function and how to replace is different from where you call it.
We have a bit of documentation here: https://manual.joomla.org/migrations/44-50/#replacement-of-factorygetuser pointing in the right direction but we can be better.
it is hard for people to help when the documentation is not clear
@brianteeman fully agree. We are working on this. Unfortunately, the problems aren't easy to solve and the internal discussions about this are ongoing.
These conversations should have taken place when the code was deprecated and not years later.
All people involved fully agree with you here. Unfortunately the people who did this have long left the project. We are currently doing their cleanup work.
I have tested this item ✅ successfully on 09114bb
I have successfully tested this - including changing the author of Articles to compare, delete articles/empty trash etc. Thanks @brianteeman
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45792.