Custom Tags not savings in OJS

Hi,
I am facing a problem in saving the meta tags here
Settings > Distribution > Custome Tags

Even when I enter a simple html tag (< h1 >This is heading 1) and hit save button. The wheel started moving but does not save it. If enter simple text and hit save button and went very well and saved it. So the problem happens only when these are meta tags.

Tried default theme, helathsciences theme but of no avail.
I have installed a fresh OJS latest version (3.1.1.4) but still the same behavior. Can anyone please guide me how to fix this issue.
Thanks and waiting for expert guidance.

Hi @seisense

Actually the header tags are meant to be without formatting, only plain text. it doesn’t make sense to format them as they are hidden, so not rendered on the page.

Regards, Primož

I want to add below plumx widget code into the header of my journal pages.

<script type=“text/javascript” src="//d39af2mgp1pqhg.cloudfront.net/widget-popup.js"></script>

So, I believe this is where I should add the script to get this widget work. Please correct me if I am wrong.

Apart from that there is another script of Google analytics. This will also go here in Metatag section of OJS.

So, I was not talking about the formatting of simple text but the above meta tags I want to add for metrics.

Hope I have made the question clear now.

Hi @seisense,

OK, I see now. That is a different story. For your purpose you have to use Cusotm Header Plugin. There you can add java script code.

Regards, Primož

Use the custom header plugin: https://pkp.sfu.ca/2018/03/01/enriching-ojs-omp-with-javascript-no-coding-required/

edit: @primozs was faster :slight_smile:

Thanks for the tip, I ll try this and update.

Sorry, the same issue persists. After inserting the script in custom header plugin and hitting the save button; wheel goes on and on but never saved the script.

Hi @seisense,

Can you check following link if it helps: Use Case/Examples for Custom header plugin for OJS

Reagrds, Primož

Thanks @primozs But in my case the problem is at first place when I enter any script in the custom header plugin it does not save at all, wheel goes on spinning…

Here is the screenshot of the custom header plugin where after hitting the save button, the wheel is spinning but does not save the script at all.
37

Looking for help gurus @asmecher @Vitaliy

Make sure you used the release from here: https://github.com/asmecher/customHeader/releases

The master branch of the plugin seems to be compatible with the master branch of OJS which is different from 3.1.1.4.

If you already had the right release, then check you error log and see what happens when you save the content.

@ajnyga
1- From Php error log below are the last few lines which i noticed when i saved the custom header plugin

[07-Oct-2018 05:58:29 America/Chicago] PHP Warning: Declaration of UploadPluginForm::fetch($request) should be compatible with Form::fetch($request, $template = NULL, $display = false) in /home/seisense/journal.seisense.com/lib/pkp/controllers/grid/plugins/form/UploadPluginForm.inc.php on line 22 [07-Oct-2018 05:58:29 America/Chicago] PHP Warning: Declaration of UploadPluginForm::execute($request) should be compatible with Form::execute() in /home/seisense/journal.seisense.com/lib/pkp/controllers/grid/plugins/form/UploadPluginForm.inc.php on line 22 [07-Oct-2018 05:58:29 America/Chicago] PHP Warning: Declaration of PluginGridHandler::initialize($request) should be compatible with CategoryGridHandler::initialize($request, $args = NULL) in /home/seisense/journal.seisense.com/lib/pkp/classes/controllers/grid/plugins/PluginGridHandler.inc.php on line 20 [07-Oct-2018 05:58:29 America/Chicago] PHP Warning: Declaration of PluginGridHandler::loadCategoryData($request, &$categoryDataElement, $filter) should be compatible with CategoryGridHandler::loadCategoryData($request, &$categoryDataElement, $filter = NULL) in /home/seisense/journal.seisense.com/lib/pkp/classes/controllers/grid/plugins/PluginGridHandler.inc.php on line 20 [07-Oct-2018 05:58:29 America/Chicago] PHP Warning: Declaration of SettingsPluginGridHandler::loadCategoryData($request, $categoryDataElement, $filter) should be compatible with PluginGridHandler::loadCategoryData($request, &$categoryDataElement, $filter) in /home/seisense/journal.seisense.com/controllers/grid/settings/plugins/SettingsPluginGridHandler.inc.php on line 18 [07-Oct-2018 05:58:29 America/Chicago] PHP Warning: Declaration of JatsTemplatePlugin::register($category, $path) should be compatible with LazyLoadPlugin::register($category, $path, $mainContextId = NULL) in /home/seisense/journal.seisense.com/plugins/generic/jatsTemplate/JatsTemplatePlugin.inc.php on line 227 [07-Oct-2018 05:58:29 America/Chicago] PHP Warning: Declaration of CustomHeaderSettingsForm::fetch($request) should be compatible with Form::fetch($request, $template = NULL, $display = false) in /home/seisense/journal.seisense.com/plugins/generic/customHeader/CustomHeaderSettingsForm.inc.php on line 73 [07-Oct-2018 05:58:29 America/Chicago] PHP Deprecated: Non-static method PKPRequest::getUserVar() should not be called statically in /home/seisense/journal.seisense.com/lib/pkp/classes/form/Form.inc.php on line 369 [07-Oct-2018 05:58:29 America/Chicago] PHP Deprecated: Non-static method PKPRequest::_checkThis() should not be called statically in /home/seisense/journal.seisense.com/lib/pkp/classes/core/PKPRequest.inc.php on line 592

2- and from the browser inspect, I found the following error:
Failed to load resource: the server responded with a status of 403 ()
screenshot is also attached
10

The 403 error there suggest that mod_security is triggered. Probably because of word “script”.

See if you can save some other value in the form. Just something like “test”. If that works, then it is probably mod_security.

mod_security rules depend on the server settings, so you need to contact you service provider. See for example Prevent mod-security 403 server errors in web hosting for more informatiom.

@ajnyga If I write any simple text in custom header plugin, it immediately saves it without any delay or error. The problem happens when I put any html tags/scripts etc…

then it is mod_security that is triggered by for example the word “script”. There is nothing that OJS can do to fix that, it all depends on the server settings, so I suggest you contact your service provider.

Let me add one more thing here:
While trying to add script in the custom header plugin I was blocked many times. Then I requested the host they provide me with this explanation;

" The ModSecurity rule that your IP triggered while making some updates to the account “seisense” has already been whitelisted. This means that you won’t be blocked if your triggered the same rule again.
If you want to avoid any further blocks, we advise you to make sure that all the software (i.e. scripts, plugins, themes) under the account “seisense” is updated to the latest version.

 

"

Now, my IP is not blocking by the host but custom header plugin is not saving the script either.
Sorry, I am not tech guy. If you can tell me what should I say to the my host service provider? Should I request them to disable Mod_Security rule for my website?

Thanks

mod_security is a good thing to have running, but if it blocks everything with the word “script” in it, the configuration should be maybe changed.

When you now try to save the form with script tag, do you still get the 403 error? Or is something else happening now?

If you do, then you could write down the exact time you try submitting the form and explain what kind of string you are trying to send and say that it triggers a 403 error. Of course mod_security is not the only thing that produces 403 errors, but seems to be the likely cause in this case.

Thanks @ajnyga I am following up with my service provider for this issue. Let us see…

Problem solved. Thanks @ajnyga @primozs