David
Forum Replies Created
-
Basically, you will need to audit any other code in your theme’s functions.php or any plugins (which is probably easier to disable one by one). You’ll need to look for a PHP method called getCookie() and you can probably do a search for “getCookie(” without the quotes, to find the code that is conflicting with the new Ninja Forms code. Once you remove the conflicting method, Ninja Forms should load again. Hopefully you understand coding, otherwise this will be pretty tough.
A second option which is only a temporary fix and I personally would not recommend doing, would be to alter Ninja Forms code directly. This isn’t a good idea because it will get overwritten on an update.
Ninja Forms File:
<YOUR-SITE>/wp-content/plugins/ninja-forms/assets/js/min/front-end-deps.jsOn line 176 you will see:
const getCookie = (cname) => {This can be altered and by changing ‘const’ to ‘var’ which should not break or conflict with anything else:
var getCookie = (cname) => {You could probably use ‘let’ instead of ‘var’ but I know ‘var’ works.
Again, you’re better off finding the conflicting code and not altering Ninja Forms directly!
Hope that helps you out.
- This reply was modified 3 years, 11 months ago by David.
So, it is conflicting with an old plugin named “Cookie Params” which uses a very similar “getCookie” method. Guessing the “getCookie” method was pulled and slightly modified from a Stack Overflow answer (maybe: https://stackoverflow.com/q/10730362/1681478) for your plugin and the “Cookie Params” plugin. We are no longer using this plugin and are removing it from our sites.
My suggestion would be to rename the method to exist in the Ninja Forms namespace, something like nfGetCookie() to avoid any future conflicts. Especially, since it looks like the method was derived from Stack Overflow.
Forum: Plugins
In reply to: [Contact Form 7] Contact Form 7 5.4 upgrade missing folderMy problem was the same as @samferguson.
I’ve migrated this site a couple times and it had the settings of an old media uploads server path. Going into: “Settings” > “Media”: “Store uploads in this folder” was incorrect. Once changed to the correct current file path, the error went away.
Running PHP 7.4.
Forum: Plugins
In reply to: [BBQ Firewall - Fast & Powerful Firewall Security] Site Health Status issues.Gotcha. Yeah, that makes this pretty useless then. At that point it would need some kind of check to see if the site itself was running a cron or site health.
Forum: Plugins
In reply to: [BBQ Firewall - Fast & Powerful Firewall Security] Site Health Status issues.While I know the power of BBQ is it’s simplicity/speed, in which removing the word is probably smarter and easier. Granted, I adapted/wrote this code, which works (with very little testing done, could have errors!) to clear out words from the current domain.
if ( preg_match( '/' . implode('|', $user_agent_array) . '/i', get_bloginfo( 'url' ), $url_matches ) ) { $user_agent_array = array_diff($user_agent_array, $url_matches); }Would go just before the existing plugin check:
if ($request_uri_string || $query_string_string || $user_agent_string || $referrer_string) {Again, the simpler solution of removing the word is probably better but just another option if you wanted to keep words in the User-Agent check while clearing out false positives automatically.
Forum: Plugins
In reply to: [BBQ Firewall - Fast & Powerful Firewall Security] Site Health Status issues.Thanks, sorry to be a pain, I know it’s an edge case.
Forum: Plugins
In reply to: [BBQ Firewall - Fast & Powerful Firewall Security] Site Health Status issues.I put some print statements into the plugin itself to see what was happening. From there I visited the “Site Health” page. Expanded the REST error and it looks like WordPress sets it’s User-Agent to the WordPress/version with the current site domain.
e.g.
The REST API call gave the following unexpected result: (403) HTTP User-Agent: WordPress/5.6; https://domainnamewiththewordninja.comWhich seems to be where all of my problems are coming from regarding User-Agent.
Forum: Plugins
In reply to: [BBQ Firewall - Fast & Powerful Firewall Security] Site Health Status issues.Jeff,
Just to be clear, this isn’t part of the referrer_items. This is coming from the user_agent_array. Not sure how the domain is being compared specifically with the User-Agent but it appears to be coming from that piece. Seems that the preg_match() for $user_agent_array is somehow seeing the site domain itself.Using your code above with referrer_items did not fix the issue for me.
However, I set:
$bbq_whitelist_user_agent_items = array(‘ninja’);
which fixed the issue, thanks.Forum: Plugins
In reply to: [BBQ Firewall - Fast & Powerful Firewall Security] Site Health Status issues.@specialk
So I ended up going through all my nginx configs and made them identical and still had the issue. Checked my WordFence settings and disabled all the plugins once again.At this point I ended up slowly commenting out piece by piece in BBQ. When I commented out the conditional isset $_SERVER[‘HTTP_USER_AGENT’] the error went away. I then started working through deleting the $user_agent_array entries. When I got to ‘ninja’ the problem disappeared. I have the word ‘ninja’ in the domain of all three sites that were having issues. So somehow it seems that ‘HTTP_USER_AGENT’ is somehow seeing the domain name along with the User-Agent.
Also, to be clear when I print out the User-Agent from the plugin itself using:
print $_SERVER[‘HTTP_USER_AGENT’];I get:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0I haven’t dissected the compare enough to yet understand what is happening here. I can dig deeper but guessing you may know off the top of your head whats happening to where User-Agent is interfering with the domain name itself. Also, guessing this would be easy to replicate by adding a word from the domain your testing from into the $user_agent_array, array.
Hopefully enough info to work with, if not let me know and more than happy to dig deeper.
Forum: Plugins
In reply to: [BBQ Firewall - Fast & Powerful Firewall Security] Site Health Status issues.@specialk
Thanks for taking the time to look into the issue. I’m running the latest BBQ plugin as well. It’s happening on three of 20 or so of my sites, all running very similar plugins. Two of those sites do run Avada but one is Twenty Nineteen. At this point I am going to dig into the nginx configs since the “Site Health” > “Site Health Info” pages look nearly identical between a working and non-working site when all plugins have been disabled but BBQ. I’ll update my findings on what the conflict is if and when I find the issue.Thanks again for looking into this and love the plugin!
@jmcelhaney,
Running 3.4.30 and everything seems fine to me. Currently running the latest PHP as well (PHP 7.4.12) without issue.Thanks for all the updates!
- This reply was modified 5 years, 6 months ago by David.
I changed line 12 to this and the error is gone.
$block = ( file_exists ( __DIR__ . '/form/block.json' ) ) ? (array)json_decode(file_get_contents(__DIR__ . '/form/block.json'), true) : array();Same issue here.
Looks like QA/QC dept. needs to install the WP plugin ‘Query Monitor’ before pushing updates live.
The error is gone but on upgrade there is some NF Maria DB migration errors. They go away when reloading so probably not a big deal. So different issue and temporary at that but including the errors just in case you wanted to check them out.
DESCRIBE IF;
NF_Database_Migrations_Forms->run()
Plugin: ninja-forms You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘IF’ at line 1 1064DESCRIBE IF;
NF_Database_Migrations_FormMeta->run()
Plugin: ninja-forms You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘IF’ at line 1 1064DESCRIBE IF;
NF_Database_Migrations_Fields->run()
Plugin: ninja-forms You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘IF’ at line 1 1064DESCRIBE IF;
NF_Database_Migrations_FieldMeta->run()
Plugin: ninja-forms You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘IF’ at line 1 1064DESCRIBE IF;
NF_Database_Migrations_Actions->run()
Plugin: ninja-forms You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘IF’ at line 1 1064DESCRIBE IF;
NF_Database_Migrations_ActionMeta->run()
Plugin: ninja-forms You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘IF’ at line 1 1064DESCRIBE IF;
NF_Database_Migrations_Objects->run()
Plugin: ninja-forms You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘IF’ at line 1 1064DESCRIBE IF;
NF_Database_Migrations_ObjectMeta->run()
Plugin: ninja-forms You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘IF’ at line 1 1064DESCRIBE IF;
NF_Database_Migrations_Relationships->run()
Plugin: ninja-forms You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘IF’ at line 1 1064DESCRIBE IF;
NF_Database_Migrations_Upgrades->run()
Plugin: ninja-forms You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘IF’ at line 1 1064DESCRIBE IF;
NF_Database_Migrations_Chunks->run()
Plugin: ninja-forms You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘IF’ at line 1@jmcelhaney, appreciate the update and no longer having to see the error.
Forum: Plugins
In reply to: [Redis Object Cache] Just updated to 2.0.9 Getting 404Also, the 2.0.10 update did fix my issue, thank you!