Search
Other Sourcerer questions
Forum

sourcerer doesn't allow save on any editor

Manos Kollias's Avatar Manos Kollias
Hi there,
after last joomla 4 update while I am trying to save any php code via sourcerer it responses with
Forbidden
You don't have permission to access this resource.
That happens with all editors (JCE, mirror etc)
thank's
Peter van Westen's Avatar Peter van Westen ADMIN
Is this when saving an article with Sourcerer code in it?
Please post a rating at the Joomla! Extensions Directory
Manos Kollias's Avatar Manos Kollias
yes
Peter van Westen's Avatar Peter van Westen ADMIN
cannot reproduce this issue.

Can you give me (super) admin access so I can take a look?
You can use the 'Confidential information' button in the forum editor to hide sensitive information.
Please post a rating at the Joomla! Extensions Directory
Manos Kollias's Avatar Manos Kollias
I added a new super user
Confidential information:
(hidden)
Peter van Westen's Avatar Peter van Westen ADMIN
I just created a new article with:
{source}<?php echo 'TEST'; ?>{/source}
And it saved fine... I don't see the issue 🤔
Please post a rating at the Joomla! Extensions Directory
Manos Kollias's Avatar Manos Kollias
please try that code which worked perfect with previous joomla 4 editions.

Confidential information:
(hidden)
Peter van Westen's Avatar Peter van Westen ADMIN
Well, that code would cause issues on the frontend anyway.
See: docs4.regularlabs.com/sourcerer/faqs/tro...th-head-or-body-tags
Please post a rating at the Joomla! Extensions Directory
Manos Kollias's Avatar Manos Kollias
ok thank's
Peter van Westen's Avatar Peter van Westen ADMIN
Also you are including external (namespaced) libraries that are not loaded by default by Joomla or Sourcerer.
So you would need to include the code that makes sure those namespaces exist, either in the Sourcerer code, or somewhere that gets run before this Sourcerer code gets executed.

If you just want to get data from the database, look into how to do that in Joomla:
docs3.regularlabs.com/sourcerer/the-basi...ting-to-the-database
Please post a rating at the Joomla! Extensions Directory
Manos Kollias's Avatar Manos Kollias
Thank's a lot Peter for your instructions but I didn't manage to make it to work.
All this code already works and you could take a look at pekk.gr/index.php/draseis/critics-2022
Clicking on every accordion the user enters dynamically on filtered data by the selected query.
What I need is to add two more names and I can't do that even if it works ( I can't save). So, if I finally can't manage to make it to work I have to desigh php files for every name something I really hate. If you could help a little more with tje specific code I would greatly appreciate it
Peter van Westen's Avatar Peter van Westen ADMIN
Well, the question is: is there an issue with Sourcerer itself, or with your custom code?

You say you get an error when saving the article. Do you mean there is an error in the article edit form when you hit save?
Or an error on the frontend where the code is getting executed?
Please post a rating at the Joomla! Extensions Directory
Manos Kollias's Avatar Manos Kollias
The only thing that I am sure is that the code works. The following test verifies it. I created a new php file (e.g. agalianou2022.php) with exactly the same code embedded. Then I called the php file via Sourcerer like {source include="agalianou2022.php"}{/source}
and it works perfectly.
I used the same code with several variations many many times until the previous Joomla editions and it worked perfectly too.
When I say I can't save I mean that while clicking on save JCE (or any other editor) button it hungs spinning over and over the save-icon endlessly with no error message and when I try to close, it responses with "Forbidden You don't have permission to access this resource."
So, I think there is an issue with Sourcerer itself in code management.
Peter van Westen's Avatar Peter van Westen ADMIN
Sourcerer is not involved when saving the article. It only is involved on the front end when that content is rendered.

You probably get the exact same issue when removing the {source} tags. Or if you completely disable the Sourcerer plugin.

So this as an issue (or security thing) of Joomla itself or the editor.

You might be able to get it to save by changing some settings on the editor configuration.
Please post a rating at the Joomla! Extensions Directory
Manos Kollias's Avatar Manos Kollias
I ask about anything because I am trying to understant what exactly changed and it can't save the code that I use the last years with Sourcerer. Could you please δο φορ me one last favor? Could you please try to add the code I sent to you in previous message by yourself? You will surely understand much more than me. Your super user account is always active. Many thank's
Peter van Westen's Avatar Peter van Westen ADMIN
Sorry, but your issue has nothing to do with Sourcerer itself.
The issue is with your own custom code.

It is beyond my support to debug and rewrite your custom code.
I already gave you some tips and pointers on where to start.

If you do not know how PHP works, I recommend you ask/hire a PHP developer to do that for you.
Or ask around on the Joomla forum:
forum.joomla.org
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription