getUserStateFromRequest falied in Joomla 1.6
I have built a new website in Joomla 1.6. I found a component which is designed for Joomla 1.5. It cannot work. The error message is "Call to a member function getUserStateFromRequest() on a non-object". I did research. I found a related post in
Joomla Forum. That is because in Joomla 1.6, $mainframe is not existed anymore. The component I installed is tried to call getUserStateFromRequest() from $mainframe. Then the solution is simple.
Please add this in /administrator/index.php
Code
global $mainframe; | |
$mainframe = JFactory::getApplication(); |
Under "$app = JFactory::getApplication('administrator');"
Now, that is all works now!
Trackback address for this post
Trackback URL (right click and copy shortcut/link location)
1 comment
This post has 3161 feedbacks awaiting moderation...
Form is loading...
Comment from: Gavin [Visitor]
Yes, they changed quite a lot of things in J1.6 … all the global variables (from J1.0 that were supported in J1.5) no longer work in J1.6. While that fix you mentioned above will work, it’s not ideal in that if you upgrade Joomla to a newer version (e.g. version 1.6.4 when it comes out, which you should do for security reasons), that /administrator/index.php file might get overwritten, and you’d have to re-apply the fix every time.
Instead, modify the component that you installed, put that fix in the main component file. Or even better, create a custom Joomla plugin (system plugin), with those two lines inside it.