Thread Starter
David
(@dkomando)
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.
Thanks for posting about this David – we had the same problem over here. Luckily the conflicting code was in our own child theme so I was able to change our function names.
What was the conflicting code for you exactly? Also the getCookie? We don’t have any olt plugins installed and need the ones we have.
Hi ninanmnm, david, same problem here but don’t get it how to fix it can explain more detailed how you fix it
Thread Starter
David
(@dkomando)
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.js
On 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 1 year, 9 months ago by David.
@dkomando Thanks for much for following up with your solution. I was fighting with this for the past 2 days until I found this and was able to fix my form (without touching Ninja’s plugin code).
@dkomando @ninanmnm @briansteeleca @lujo9 @naturfreundeschweiz
I’m sorry to hear you are experiencing this. Can you update your Ninja Forms plugins to their latest versions and let me know if you continue to have the same issues?
If you are still seeing the issue, can you contact our official support (https://ninjaforms.com/contact) so we can take a closer look at your issue?
@jmcelhaney Thank you very much. With the newest version it seems to work for me!