MyBB Community Forums

Full Version: General question I just can't seem to find an answer for
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ok, so I'm editing templates and when I try to save it, I am told it won't save because it detected some kind of security risk. Here is a copy of the error:
The following errors were encountered:
* A potential security issue was found in the template. Please review your changes or contact the MyBB Group for support.


I'm simply attempting to edit a small piece of coding that I know for a fact is safe, and I want it saved.

How can I bypass this error and make it save? If that's not possible, then how is an alternate way to access that information and add that line of code? I have already tried search & replace in the admin panel and it actually won't replace the line of code that way either.



Any help would be greatly appreciated. I am definitely loving MyBB since somebody pointed me in this direction a while back.

Thanks!
How do I save a change that I know is safe, but the Admin panel in MyBB won't save because it claims it's a security risk?
As far as I know, you can't use "$something". If you're using a variable, it needs to be "${something}". That's one thing that I've noticed from experience, there may be other issues with this as well.
That's not a valid piece of code. MyBB's template system is relatively simple. You can only use variables. If you want to replace something you'll need to develop a plugin for it.

For security reasons certain regular expressions are in place to prevent malicious code being inserted in to templates.
The piece of code I'm attempting is valid and works on other systems. It's possible I could be misunderstanding something but I believe when a variable has

|replace:"this":"that"

added to it, then it will replace all instances of "this" with the word "that" in the output on screen.

So for example: {$hello|replace:"this":"that"}
should work, and does work elsewhere, but MyBB won't save it.

Again I may be missing something here as I'm not an expert, but what's stopping it from working here when it works elsewhere... and how do I force it to just work?
It won't work at all. MyBB's template system simply evaluates the variables. You're probably thinking of something such as Twig which has advanced features to manipulate data.

If you want to replace something within a variable, create a plugin and use str_replace(). There's no way to do it via the template system without either core edits or a plugin.
I will give it a shot. I am familiar with coding and I am guessing creating a plugin is pretty simple for just replacing a string, but I'd have literally no clue where to physically even begin the exploration of how to "create" it.

Point me in the right direction? Is there maybe a guide for creating a simple plugin for MyBB? And how can I make it only take effect while a thread is being viewed? ( I don't want the terms replaced forum-wide )
Got it working.

THANKS!!!