Note: We probably should have called this post “You Do Not Have Access to the Administrator Section of This Site” Error When Trying to Login to Joomla’s Frontend, but we went with the current title because we thought it was shorter, catchier, and much more original…
The #__assets table in a Joomla database is not the best thing since sliced bread. In fact, we think it should be gone as previously mentioned here, and one of the reasons it should be gone, besides all the performance problems it causes, is the instability associated with it. Let us give you a very recent example of an instability caused by the assets table…
This afternoon, around 1:00 PM EST, a new client called us and told us that he was seeing the following error when trying to login to the frontend of his Joomla website: “You do not have access to the administrator section of this site”. Now, we have discussed this issue before, but in a context where the user was trying to login to the backend of the site, and not to the frontend.
We started investigating the problem, jumping through hoops from one file to another, slowly but surely confirming that the problem was in the #__assets table, until we finally reached the file tablenested.php which is located under the libraries/joomla/database folder. In that file, there is a function called getRootId being called when authenticating the user. The function just queries the #__assets table for all the entries that have no parents. If you are experienced with Joomla’s internals, you will know that Root is the only entry in the #__assets table that shouldn’t have a parent. Apparently, the function getRootId knows this as well and tries to enforce it (we think it’s the wrong place to enforce this), and so if the query returns more than 1 result, then the authentication will fail. Unfortunately, in our case, the query returned about 15 rows (and that’s why the authentication wasn’t working). So, we looked at the database and it turned out that one lousy extension called com_booking created 14 rows with no parents. We addressed this problem by manually updating each of these rows to have Root as parent (e.g. we updated the parent field for these rows to be 1).
It took us nearly 3 hours to solve this nasty problem, and we could have easily modified a core file to fix it in 15 minutes. But we wanted to do a clean job, and we believe that we did do a clean job!
So, if you see the error “You do not have access to the administrator section of this site” when trying to login to the frontend, then check your #__assets table (in phpMyAdmin), and see if you have an entry, other than Root, that doesn’t have a parent. If you do find one, then change its parent to 1 and your issue will be resolved. If you think that this whole thing is a bit over your head, then please contact us. Our rates are affordable, our job is professional and neat, and we are the friendliest programmers on this solar system!