So I have run into a bit of a strange problem and can not seem to find a solution. Maybe someone has had the same issue and can shed some light.
I am writing a component and I am adding front end editing to it, but when I save my front end form I end up with the following error:
You are not permitted to use that link to directly access that page
(#1).
I have tracked the issue down to the checkEditId() function in JController. It returns false because “I have somehow just arrived at the form without clicking on a link”. So I understand that I somehow have to setUserState(‘com_component.context.item’, $id); as the problem is that the “id” is not in the userstate session.
But where do I add that? I have tried adding it manually using the setUserState() function but that does not appear to work and I can also see that com_content does not do it like that?
How am I meant to tell Joomla that the user is allowed to edit the item – not from an ACL point of view but from a – he just clicked on the edit link point of view?
I was having the exact same problem. What solved it for me was to make sure the URL format was correct on the list view. So I had:
administrator/index.php?option=com_helloworld&view=offer&layout=edit&offer_id=27
but you need the URL as follows:
administrator/index.php?option=com_helloworld&task=offer.edit&offer_id=27
This ensures that the ID of the item being edited is added to the session scope which is then checked in checkEditId().
This should solve your problem.