apsislabs / cf7-gated-content

Contact Form 7 Gated Content
2 stars 1 forks source link

Gated content won't display download button #9

Closed amyburritt closed 4 years ago

amyburritt commented 5 years ago

I've created a form for gated content, but when the user clicks "Submit" the page does not show the download button. It will only show it if the user refreshes the page or submits the form a second time. Here is the page: https://www.thequotientgroup.com/in-terminal-advertising-test/ Thanks!

wkirby commented 5 years ago

Hi @amyburritt, thanks for the report. After submitting the form, it looks like something in your theme or plugins is modifying the output of the Contact Form 7 success messages, which is interfering with this plugin's ability to add the download button.

There are a few options here:

  1. Look for anywhere in your theme or plugin files that is using the wpcf7_form_response_output filter and try to identify how it's modifying the output. cf7-gated-content uses this filter to render the download button for non-AJAX forms, and it appears something else might be unsetting the contents.
  2. Identify why AJAX submission isn't working for CF7. By default CF7 should submit with AJAX, but does not appear to be doing so on your site. If CF7 submits via AJAX, we will add the download button via AJAX as well, and won't use the wpcf7_form_response_output mentioned above.
  3. If you're comfortable, you can email me a list of plugins and themes in use on your site at wyatt@apsis.io and I can try to identify what the problem interraction is.
amyburritt commented 5 years ago

Thank you so much for your quick response, Wyatt! Thank goodness you included item 3 below because 1 and 2 are over my head. :) Attached are the plugins we have on the site -- see anything weird right off?

Thanks!

Amy Burritt 828-423-9695

On Mon, Oct 7, 2019 at 2:45 PM Wyatt Kirby notifications@github.com wrote:

Hi @amyburritt https://github.com/amyburritt, thanks for the report. After submitting the form, it looks like something in your theme or plugins is modifying the output of the Contact Form 7 success messages, which is interfering with this plugin's ability to add the download button.

There are a few options here:

  1. Look for anywhere in your theme or plugin files that is using the wpcf7_form_response_output filter and try to identify how it's modifying the output. cf7-gated-content uses this filter to render the download button for non-AJAX forms, and it appears something else might be unsetting the contents.
  2. Identify why AJAX submission isn't working for CF7. By default CF7 should submit with AJAX, but does not appear to be doing so on your site. If CF7 submits via AJAX, we will add the download button via AJAX as well, and won't use the wpcf7_form_response_output mentioned above.
  3. If you're comfortable, you can email me a list of plugins and themes in use on your site at wyatt@apsis.io and I can try to identify what the problem interraction is.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/apsislabs/cf7-gated-content/issues/9?email_source=notifications&email_token=ANNKOWQJSHUYNOFT26TK4W3QNN7T3A5CNFSM4I6H5TY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEARMTSY#issuecomment-539150795, or mute the thread https://github.com/notifications/unsubscribe-auth/ANNKOWTTXJYAOQILUSFQQZTQNN7T3ANCNFSM4I6H5TYQ .

wkirby commented 5 years ago

Hi @amyburritt,

I don't think your attachments came through in the GitHub thread. If you don't mind sending them to me directly at wyatt@apsis.io, I would very much appreciate it.

mikegovernale commented 4 years ago

Was this solved? I'm having the same issue on a site using WP Visual Bakery.

wkirby commented 4 years ago

Hi @mikegovernale,

I have successfully tested this plugin using WP Visual Bakery. Can you provide a link to your site where I can view the form that is failing? It would also be helpful to know what other plugins you are running. If you are not comfortable providing those in a public Github issue, you can email them to me at wyatt@apsis.io.

mikegovernale commented 4 years ago

Hi @wkirby, Thank you for the reply! The URL is: http://www.pronexusllc.com/gated-content-form

Below is a list of all plugins being used. I've tried disabling them (except for WPBakery Visual Composer) but no luck.

Also, I noticed that "Download Button Text" and "Button CSS Classes" aren't working. It seems to ignore any values I enter in those fields. Not sure if that is related to the core issue.

wkirby commented 4 years ago

Thanks @mikegovernale. Sorry for the flurry of form submissions from me. I was testing to see if I can identify the problem.

The issue appears to be that the CF7 javascript events are not firing. The most likely cause is that there is some code in either your theme or plugin that is intercepting the submit event for the form. A simple way to test would be to enable the default Wordpress theme with all your current plugins and attempt to submit the form. If the download button appears, you know the issue is in your theme files. If it doesn't, then one of your plugins is the culprit.

Details on the CF7 DOM events can be found here: https://contactform7.com/dom-events/, while a small page on why DOM events might not be working can be found here: https://contactform7.com/faq/dom-event-doesnt-work/

For reference, I determined this was the issue by attaching a new javascript event listener using the following code, and submitting the form:

var $form = $('#wpcf7-f10410-o1 > form');
$form.on("wpcf7submit", () => console.log("CF7 Submit Event"));
$form.on("wpcf7mailsent", () => console.log("CF7 Mail Sent Event"));
$form.on("wpcf7invalid", () => console.log("CF7 Invalid Event"));
$form.on("submit", () => console.log("Standard Submit Event"));

If you paste that into your browser's console and submit the form, you'll see that the wpcf7submit event is not fired. Because of this, we cannot hook into the submission event, and cannot add the download button after the AJAX response has completed.

Once you sort out what is causing the javascript event issue, our plugin should begin working.

mikegovernale commented 4 years ago

@wkirby, that makes sense. I just tried activating the Wordpress Twenty Twenty theme and reloaded the page. Upon submission it showed the 'success' message, but the download button still didn't show. Next I tried disabling all plugins (except for WP Visual Bakery) with the Twenty Twenty theme still active. Same result. No download button. I'm stuck.

wkirby commented 4 years ago

@mikegovernale what version of WP Bakery are you using? I will see if I can reproduce the issue locally.

mikegovernale commented 4 years ago

Thank you @wkirby... It's WPBakery Visual Composer version 4.12. Wordpress has been updated to 5.3.2.

wkirby commented 4 years ago

@mikegovernale I've only got access to WPBakery 5.6 and above. It looks like WPBakery is now up to version 6.1. I don't have a way to go back and get earlier versions of the plugin. If you're able to package it up and send it to me (wyatt@apsis.io) I can take a stab at debugging this further. I will say that the plugin does work on both WPBakery 5.6 and WPBakery 6.1.

mikegovernale commented 4 years ago

I appreciate that offer @wkirby. I think it might be best for me to try a different plugin though. This website isn't mine, or else I'd go ahead and upgrade Visual Bakery. Thanks again for looking into this for me.

wkirby commented 4 years ago

@mikegovernale sorry I couldn't solve the issue! I would be aware that it's not just our plugin — but any CF7 plugin that hooks into the javascript events won't work.

wkirby commented 4 years ago

Closing as stale