How to Avoid Fatal Error, less fragile Shortcode Syntax, and correct timestamps?
-
Hello, I recently upgraded EBD 6.9.7 and DM 4.9.10 and CF7 5.8.7 and subsequently was not receiving the notification email and the email was not logging in EBD. CF7 was successfully sending the notification email to the admin contact. Then, I remembered that I had updated the page with the CF7 shortcode (rather than the EBD shortcode). When I looked at the documentation for the shortcode syntax, it says:
Add the following short code using the IDs collected in the first two steps [email-download download_id=”X” contact_form_id=”Y”]
When I use that syntax with the correct download ID and form ID, I encountered a fatal error (see below). I thought perhaps it could have been that the syntax shows double quotes around the “ID”, and yet, when you copy the DM shortcode from the form list, it gives you a different syntax like this with single quotes: [download id=’123′]. Maybe that doesn’t matter?
Fatal error: Uncaught Error: Call to a member function getAttribute() on null in /path/wp-content/plugins/email-before-download/includes/class-email-before-download-form.php:39 Stack trace: #0 /path/wp-content/plugins/email-before-download/includes/class-email-before-download-shortcode.php(68): Email_Before_Download_Form->html() #1 /path/wp-includes/shortcodes.php(433): Email_Before_Download_Shortcode->init_shortcode(Array, ”, ’email-download’) #2 [internal function]: do_shortcode_tag(Array) #3 /path/wp-includes/shortcodes.php(273): preg_replace_callback(‘/\\[(\\[?)(email\\…’, ‘do_shortcode_ta…’, ‘<p>Founded in 1…’) #4 /path/wp-content/plugins/all-in-one-seo-pack/app/Common/Traits/Helpers/Shortcodes.php(140): do_shortcode(‘<p>Founded in 1…’) #5 /path/wp-content/plugins/all-in-one-seo-pack/app/Common/Traits/ in /path/wp-content/plugins/email-before-download/includes/class-email-before-download-form.php on line 39
Just a thought, instead of causing a fatal error that kills the page, how might this be handled with the simple non-rendering of the form and displaying a warning to check an error log (i.e., “Your form is experiencing problems, please check the flux capacitor.”) for the plugin or something less disruptive?
As it turns out, the fatal error was due to the fact that the form ID was missing a character (my fault). I corrected that, and then tested the page, no error! I submitted the form; the notification arrived! The email was logged (wrong timestamp, though)! Lastly, the confirmation email with the link arrived! Whohooo!
Three things I am asking for help with:
ONE: The confirmation was marked as SPAM. Any forum/support info on how to address that?
TWO: The timestamp on the log was not in sync with the time settings on the site. It was 3 hours ahead. Can the timestamp issue be addressed? Are there settings I missed?
THREE: Suppose one had lots of forms and/or downloads? It might be helpful to have a little tool to build the shortcode in a foolproof way (adhering to syntax) and log that build (for future reference).
Lastly, and because the following mistake was also confounding, if you have a staging site, and you’re not pushing the whole staging area back over…DOUBLE CHECK YOUR FORM AND DOWNLOAD ID CODES. The form codes may be different!
Thank you to everyone who contributed to this plugin. I wanted to share my experience so that it may help someone who may facing the same issue. If upon seeing this error/post, someone sees anything else I’m not doing properly or has advice, please share your remarks below. Thanks!
- The topic ‘How to Avoid Fatal Error, less fragile Shortcode Syntax, and correct timestamps?’ is closed to new replies.