You don't have permission to access this. Please contact a website administrator if this is incorrect. Topic is solved

General questions relating to Joomla! 4.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Locked
neojw1505
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 142
Joined: Wed Aug 11, 2021 12:44 pm

You don't have permission to access this. Please contact a website administrator if this is incorrect.

Post by neojw1505 » Fri Sep 17, 2021 9:27 am

Hi all, I am a beginner in Joomla and was getting this error (error is subject) every time I login as a user on my website. I have linked the images of the error and attached my Login function code as login.txt. I do not know why the alert is popping up even after a successful login and would like to prevent it from showing. Appreciate everyone that takes the time to read this and have a great day :)

- Image of the error -
https://prnt.sc/1sjlnqn
You do not have the required permissions to view the files attached to this post.

User avatar
AMurray
Joomla! Exemplar
Joomla! Exemplar
Posts: 9711
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: You don't have permission to access this. Please contact a website administrator if this is incorrect.

Post by AMurray » Fri Sep 17, 2021 10:07 am

It seems there's something without the correct permissions e.g. a module or something and that's what the errors alerting you for. You can't just 'turn if off' without figuring out the problem.

Are you logging on with a full super user or something else?

Is the 'login function code' something you created or is it Joomla system code?
Regards - A Murray
General Support Moderator

neojw1505
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 142
Joined: Wed Aug 11, 2021 12:44 pm

Re: You don't have permission to access this. Please contact a website administrator if this is incorrect.

Post by neojw1505 » Fri Sep 17, 2021 12:56 pm

I am logging in with a super user account but the same thing occurs. Yes, the login function code is written by me. Could it be something wrong with my login function code?

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30892
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: You don't have permission to access this. Please contact a website administrator if this is incorrect.

Post by Per Yngve Berg » Fri Sep 17, 2021 2:59 pm

Why are you coding a login function? What are you trying to achieve?

neojw1505
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 142
Joined: Wed Aug 11, 2021 12:44 pm

Re: You don't have permission to access this. Please contact a website administrator if this is incorrect.

Post by neojw1505 » Fri Sep 17, 2021 3:14 pm

Per Yngve Berg wrote:
Fri Sep 17, 2021 2:59 pm
Why are you coding a login function? What are you trying to achieve?
So that I can change my state to login? and users that are logged in have access to more features

User avatar
Pavel-ww
Joomla! Ace
Joomla! Ace
Posts: 1618
Joined: Tue Jun 30, 2020 12:17 pm

Re: You don't have permission to access this. Please contact a website administrator if this is incorrect.

Post by Pavel-ww » Fri Sep 17, 2021 3:51 pm

Hi. Check the owner of the site's files on the server. For example, this often happens when using VPS/VDS when you manipulate the files under the root user, instead of using the domain user. (just happened to me :D )

neojw1505
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 142
Joined: Wed Aug 11, 2021 12:44 pm

Re: You don't have permission to access this. Please contact a website administrator if this is incorrect.

Post by neojw1505 » Fri Sep 17, 2021 4:17 pm

Pavel-ww wrote:
Fri Sep 17, 2021 3:51 pm
Hi. Check the owner of the site's files on the server. For example, this often happens when using VPS/VDS when you manipulate the files under the root user, instead of using the domain user. (just happened to me :D )
Thanks, for the quick reply.
Ok so I just have to check who is the owner of the file and can you guide me on what should I do after that?

User avatar
Pavel-ww
Joomla! Ace
Joomla! Ace
Posts: 1618
Joined: Tue Jun 30, 2020 12:17 pm

Re: You don't have permission to access this. Please contact a website administrator if this is incorrect.

Post by Pavel-ww » Fri Sep 17, 2021 4:32 pm

neojw1505 wrote:
Fri Sep 17, 2021 4:17 pm
Thanks, for the quick reply.
Ok so I just have to check who is the owner of the file and can you guide me on what should I do after that?
If the owner is not the right user, you need to change it to the right one. It can be done by bunch, for all files and folders. Specific functionality depends on the hosting panel.

User avatar
ceford
Joomla! Hero
Joomla! Hero
Posts: 2654
Joined: Mon Feb 24, 2014 10:38 pm
Location: Edinburgh, Scotland
Contact:

Re: You don't have permission to access this. Please contact a website administrator if this is incorrect.

Post by ceford » Fri Sep 17, 2021 11:16 pm

Do you have a login menu item? Set the Login redirect to the Home page menu item. Same for the Logout redirect. Same if you are using a module to login - set the Login and Logout redirection pages. Tell us if that fixes the message.

neojw1505
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 142
Joined: Wed Aug 11, 2021 12:44 pm

Re: You don't have permission to access this. Please contact a website administrator if this is incorrect.

Post by neojw1505 » Sat Sep 18, 2021 11:42 am

ceford wrote:
Fri Sep 17, 2021 11:16 pm
Do you have a login menu item? Set the Login redirect to the Home page menu item. Same for the Logout redirect. Same if you are using a module to login - set the Login and Logout redirection pages. Tell us if that fixes the message.
Thank you good sir! this solves it for me :)
I went and set the login and logout menu item to redirect to the home page and the message is gone. But I would like to understand and learn how does doing this fixes this problem.

User avatar
ceford
Joomla! Hero
Joomla! Hero
Posts: 2654
Joined: Mon Feb 24, 2014 10:38 pm
Location: Edinburgh, Scotland
Contact:

Re: You don't have permission to access this. Please contact a website administrator if this is incorrect.

Post by ceford » Sat Sep 18, 2021 12:44 pm

But I would like to understand and learn how does doing this fixes this problem.
To find the problem:

First find the error message in the language ini files - you will find this one in joomla.ini - and that gives you the key to look for in the code - JERROR_ALERTNOAUTHOR.

Then look for that key in the php code. You will find it in several places. In this case it is libraries/src/Application/SiteApplication.php on line 120 that is relevant.

Then read the code: the function is checking you are authorised to access a menu item. You are not even though you are logged in. So the error message is queued and you are redirected to the home page. That means there may be something wrong with your own code or you have forgotten to redirect to an authorised menu item, for example if you are trying to stay on the Edit Profile page after logout.

neojw1505
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 142
Joined: Wed Aug 11, 2021 12:44 pm

Re: You don't have permission to access this. Please contact a website administrator if this is incorrect.

Post by neojw1505 » Mon Sep 20, 2021 1:07 am

ceford wrote:
Sat Sep 18, 2021 12:44 pm
But I would like to understand and learn how does doing this fixes this problem.
To find the problem:

First find the error message in the language ini files - you will find this one in joomla.ini - and that gives you the key to look for in the code - JERROR_ALERTNOAUTHOR.

Then look for that key in the php code. You will find it in several places. In this case it is libraries/src/Application/SiteApplication.php on line 120 that is relevant.

Then read the code: the function is checking you are authorised to access a menu item. You are not even though you are logged in. So the error message is queued and you are redirected to the home page. That means there may be something wrong with your own code or you have forgotten to redirect to an authorised menu item, for example if you are trying to stay on the Edit Profile page after logout.
I understand now. Thank you so much :)


Locked

Return to “General Questions/New to Joomla! 4.x”