Lewiscowles1986 / WordPressSVGPlugin

WordPress SVG Plugin
GNU General Public License v3.0
42 stars 4 forks source link

jQuery errors breaks form notification settings page when using Gravity Forms #33

Closed davemac closed 6 years ago

davemac commented 6 years ago

With the plugin enabled, getting lots of Uncaught ReferenceError: jQuery is not defined on any Gravity Forms form notification settings page.

Example notification settings page for as for is eg wp-admin/admin.php?page=gf_edit_forms&view=settings&subview=notification&id=1

All other Gravity Forms settings pages are OK.

Lewiscowles1986 commented 6 years ago

Is it just a console error or does it break / disrupt the admin?

Thanks for raising 😊

davemac commented 6 years ago

It breaks and disrupts the admin, as well as throes errors in the console.

Lewiscowles1986 commented 6 years ago

Hi Dave,

just tidied up the email signature bit (not needed here)

The strange thing is that this plugin doesn't change jQuery, it string replaces verbatim WordPress code which is JS, but takes entire structures.

Could you please let me know

Have you also tested this with this plugin deactivated, and could you send me the redacted console.log (replace just url with #### chars if it matters), and the html with and without this plugin activated.

I know it seems like a lot, but it's the easiest way for me to see what is being found and replaced (can only be the HTML if it's this plugin)

davemac commented 6 years ago

Thanks for following up.

I have done a fresh install of WP 4.9.5 using the default twentyseventeen theme, with only gravityforms 2.3 and enable-svg-uploads 1.9.1 plugins activated.

I can still replicate the issue.

If I deactivate enable-svg-uploads, the issue disappears.

I've attached the console.log output.

HTML with and without issue

Lewiscowles1986 commented 6 years ago

Oh wow... This looks like output buffering is the culprit. It's returning the end of the html, then the beginning if that makes sense.

Because there is no hook I know of to alter WordPress templates, we buffer the entire output, then reassemble it at the end.

I don't have an insta-fix (I'll have to get access to gravity forms 2.3 to see at what point it's triggering the footer to come out in the header). But thanks for raising.

Lewiscowles1986 commented 6 years ago

There is another plugin for logging hooks and actions https://github.com/WordPress-Thinstall/working-files/blob/master/plugins/wp-save-hooks-sql.php.

It logs all hooks fired and saves that to SQL. I know it was non-trivial ask to get the HTML output, but the SQL generated by loading the broken page whilst this plugin is activated if you can, is incredibly clear cut. It's like walking the stack with a debugger, but focused on hooks (since that is mostly where WP farts).

open two tabs is probably easiest

That would get around waiting for me to get Gravity Forms.

Totally understand if this is too big an ask, eventually, I'll work it out anyway, but I only have limited time to spend on this reference plugin.

Lewiscowles1986 commented 6 years ago

Files stash wordpress-svg-gravity-forms.zip

Lewiscowles1986 commented 6 years ago

Diff online (looking more sane of manually-fixed vs without plugin)

https://www.diffchecker.com/MMF5mkIg

Lewiscowles1986 commented 6 years ago

Note: https://github.com/wp-premium/gravityforms only tags gravity forms to 2.2.x

Lewiscowles1986 commented 6 years ago

http://uninterested-newt.w6.gravitydemo.com/wp-admin/admin.php?page=gf_edit_forms&id=1 created via gravityforms web UI does not replicate for new or existing forms... :mag:

Edit: It's not using 2.3.

Lewiscowles1986 commented 6 years ago

I've reached out to another WordPress form plugin as well as Gravity forms. Lets see if we cannot find an interim solution for you. Gravity forms 2.2 still works, but I'm sure we all know using old plugins is a bad idea. Caldera forms also works, I've tested a few releases including their latest. Wondering if @cicichirinos or @Shelob9 from Caldera can connect with you whilst I work out how to overcome whatever Gravity Forms are doing?

Lewiscowles1986 commented 6 years ago

Jeff replied > Cc: ****2@icloud.com | May 14, 1:22pm Hey Lewis,We've recently pushed updates of Gravity Forms as well as all add-ons to any new demo sites created. If you create a new demo, you should now see the updated version. __Jeff MatsonGravity Formshttp://www.gravityforms.com

@davemac is there any way you could re-test? I'm looking into a way to stop needing the ob_start at all, but for now it'd be great if they fixed GF to not abuse output buffering.