No inline link, no email. Just loading in loop.
-
Hello everybody,
I’m a WP new user and I’m trying to use Email Before Download (EBD) in my site.
I’ve correctly activated both Contact Form 7 (CF7) and Download Monitor (DM), following the well-known “three steps” (uploading the file in DM, creating a form with CF7 and pasting the shortcode).–> Results: both Inline Link and Send Email don’t work. In both the cases, I can only see the loading arrows continuing to turn around in loop. I can’t see any link and I don’t receive any email, just the CF7 email with the download notification. <–
I’ve already checked some old posts about the wp_footer and the ajax that maybe could help me to solve my problem. But as I’ve said, I’m a WP really new user so I don’t even know what is the footer and what is ajax. I don’t know where finding it or how to modify it. I’ve just started to develop a site created by another webmaster!
If someone has some suggestions about my problem or can help me to understand in a simple way how to check or modify the wp_footer, it could be amazing!
Thank you for pay attention.
Luca
-
Hi — as a new wordpress user I’m surprised you got as far as you did really. Lots of brand new folks download “Download Manager” by mistake rather than “Download Monitor” ??
I appreciate the fact that you looked back through old issues to try and fix this yourself. I’ll give you one of my patented long explanations as a thanks ??
So, the problem is very likely that you have warnings/errors going to the screen rather than to a file. In PHP-land, that stuff is controlled by settings in your php.ini file (and you can have multiple ones of those .. sometimes one for Apache and one for php from the command line, etc). It can get a little complicated. Anyway, in that file there are some settings that tell PHP whether or not to spit out warnings, errors, or only critical stuff and then also where to spit it .. out to the display (or whatever started the program) or to a file. So, you might have that stuff set to go to the display rather than to a file. But, that’s PHP-land.
In WordPress-land, I think that stuff is controlled by WordPress settings (though it might be controlled at both levels .. I’ve never really bothered to figure it out all the way). Anyway, in WordPress-land, turning on WP_DEBUG is how you normally debug stuff. USUALLY that is turned on or off in the index.php file in your wordpress directory. IF it’s ON then errors and/or warnings are going to go somewhere. I think they’ll end up going to the screen if php.ini says so … or, there is also a WordPress settings that controls that as well (called display_errors). See this post from someone that talks about this stuff better than I’m doing: https://aristath.github.io/blog/wp-hide-php-errors
The reason this is a problem is that EBD sends back an AJAX response when the website visitor hits the submit button. That response is JSON. If display errors is on, then there is a warning that happens then and that warning text gets mushed into the JSON and corrupts it and everything hangs. Turning off display of errors/warnings is the easiest way to fix it. A perhaps better way is to make all your errors/warnings go to a file somewhere by setting that stuff in php.ini. That’s what I do … that way I can still see that stuff, but I never accidentally poop out a bunch of errors to some website visitor who went to a wordpress page on my site that had a problem. But, either way, the main thing is to stop those messages, which should fix the issue that you’re seeing.
If it doesn’t fix it, post a URL so I can go try your site.
ps – The Description page for EBD states that you have to use that old version of Download Monitor and it gives you a link to it. That is not actually the case. You can use the latest version of Download Monitor. The advantage of using the latest DM is that EBD will generate far fewer warnings and errors (the older DM works .. you’ll just see scary-looking warnings & error msgs in the log [assuming you make that stuff go to a file]. You can ignore those errors/warnings .. they don’t really matter, but they are unsettling). If you have the old DM right now, you can just remove it and then install the latest one and then re-upload your file into it. Note that the new DM works/looks quite a bit different when you go to add/upload a file .. it looks like you’re making a post or page in wordpress .. takes a bit of getting used to .. see DM documentation if you get confused).
Hi Dtynan,
thank you for your thorough answer. I really appreciated it.I started to check the simpliest issue you reccomend by checking my version of Download Monitor and I think I already have the last plugin version (1.9.5, right?).
Then, about PHP-land, I’m quite confused about what do you mean with warnings spitted out into the file. I don’t see any warning in my screens. Neither in the published pages nor in the setting pages. The only exception is Contact Form 7 which says
“One configuration error found” –> “Multiple form checks are located in a single label”
It probably refers to my checkbox shortcode: [checkbox* newsletter exclusive “Subscrive” “No, thanks”] but I found this code in the CF7 tutorial and it works well if I don’t use EBD.
But I don’t think we are speaking about the same “warnings”.Finally, in WordPress-land the fact is that I don’t have the WP directory in my computer. It probably is in the old webmaster’s computer. I found really clear your explanation and the one in the link you shared but right now I can’t do nothing in this direction.
Right now, I’m trying to contact the old webmaster and sharing with him my problem and your solutions. Meanwhile, I share with you my plugins and WP versions and a url of a trial page with the EBD shortcode.
WP version: 4.6.1
Download Monitor version: 1.9.5
Contact Form 7 version: 4.5.1
Email Before Download version: 3.4.2Trial page with the form (in Italian but you can understand)
Thank you again for your precious help.
Ok I checked your page and the problem is what I suspected — there is a “notice” message about an undefined index and that message is getting combined with the ajax response and hanging everything. The content of the notice message is not important, but the fact that it is getting mixed into the ajax response is a problem.
So, I did a little reading to refresh my memory on how this stuff works. I read this page:
https://codex.www.ads-software.com/Debugging_in_WordPressIn there it says that if WP_DEBUG is ‘on’ then it will make all the PHP errors, warnings, and notices start showing up. They will basically go to the screen (get mixed in with the html and stuff) unless you make them go to a file.
So, as you can see, you either need to turn WP_DEBUG off entirely, or you need to at least turn WP_DEBUG_DISPLAY off (and then you could turn WP_DEBUG_LOG on if you wanted to log those errors/warnings/notices to the error file (“debug.log”).
WP_DEBUG is probably getting turned on in the wp-config.php file in your main wordpress directory (or possibly in the index.php file in that same directory). You need to edit wp-config.php and find the line where it is turned on and change it to off. Or, leave it on but add a line to turn WP_DEBUG_DISPLAY off (and possibly another line to turn WP_DEBUG_LOG on if you want that stuff to a file).
You will need to be able to access your main WordPress directory to do this stuff. Normally people do that by using a text editor and editing those files on the server or maybe they edit them locally and ftp them up to the server or something along those lines.
ps – you can ignore the PHP-land stuff from my prior update .. you just need to set/change those wordpress debug settings to fix this.
Hi Dtynan,
I’m sorry for the delay between our answers. I finally spoken with the old webmaster who gave me the password to have access to the server and to the wp directory.
Thus, I found the wp-config.php file (I also checked the index.php but I didn’t find any debug code in it) and I tried to change it, trying both the strategies:A) I tried to turn off the wp debug by modifying the existing code:
define( ‘WP_DEBUG’, false );
B) I tried to add the debug display and log as you reccommended:
define( ‘WP_DEBUG’, true );
define( ‘WP_DEBUG_LOG’, true );
define( ‘WP_DEBUG_DISPLAY’, false );Then I uploaded the modified wp-config.php file on the server but in both the cases nothing have changed and I continue to see the loading arrows without file download as you can see here (in this moment the wp-config is set like in the strategy A, with the WP_DEBUG turned off).
Could you check it again and see if the problem is the same?Thank you for all your help,
LucaHi, yeah still the same problem. So, when I press submit on your form, this is the response that comes back:
<br /> <b>Notice</b>: Undefined index: ebd_downloads in <b>/home/insidesc/public_html/wp-content/plugins/email-before-download/email-before-download.php</b> on line <b>432</b><br /> {"mailSent":true,"into":"#wpcf7-f32037-p32091-o1","captcha":null,"message":"Grazie! Puoi scaricare la brochure dal seguente link: http:\/\/www.insidescience.net\/wp-content\/uploads\/2016\/10\/Workshop-HRV-BFB-2016-seconda-edizione.pdf","onSentOk":["document.getElementById('wpm_download_4').style.display = 'inline'; document.getElementById('wpm_download_4').innerHTML='The link to the file(s) has been emailed to you.'; "]}
That first part, the HTML stuff, shouldn’t be there. It should just start with the {“mailSent” section and all the stuff after that. That part is JSON. The stuff before it is HTML. The javascript code that executes when you press the Submit button expects to get back just the JSON part. So, as I said previously, what’s happening is that that Notice warning message is getting in there too and messing it up.
As a side note, I don’t know if you know how to use Firebug (in Firefox) or Developer Tools (in Chrome), but if you do, all I’m doing to see that is going to your page, then I bring up Firebug or Developer Tools and I put it on the “Network” tab and then I fill in the form on your page and hit submit, and then you can see that transaction happen in Firebug or Developer Tools and if you click on it and go to the “Response” tab you’ll see the exact stuff above that I pasted in.
So, getting back to the actual problem, you have to figure out how to turn that notice off. Aside from WP_DEBUG (which is a WordPress setting), PHP has its own settings for that stuff. I think the PHP one will still work even if WP_DEBUG is off, so perhaps that’s what is causing the issue. You need to find php.ini and edit it and look for display_errors and turn it off or make it go to a file. There can be multiple php.ini files, which makes this kinda tough sometimes. If you’re on a 3rd party hosting site, then their support can probably help you (or it might be on the menu/control panel that they give you).
Hmm. You could do this if you wanted to. You could just edit the Email Before Download php files themselves and put in a couple of commands at the top to make sure WP_DEBUG is off and PHP is not displaying errors. That’s not the best long-term solution since your changes will get overwritten if you ever upgrade the plugin, but it should at least solve the problem for now. To do that, I would edit email-before-download.php and put
define( ‘WP_DEBUG’, false );
at the top just after the first line (before the comment but after the php command) and then try it. If it still doesn’t work, then add:
ini_set(‘display_errors’, ‘0’);
and try againBe sure to update this and let me know if you get it working and what happened
Hi Dtynan,
thank you for your answer. Unfortunately, even with your last recommendations It doesn’t work.As you recommended, I tried to add the define( ‘WP_DEBUG’, false ); firstly alone and then followed by ini_set(‘display_errors’, ‘0’); but (guess…) it doesn’t work and the html warning code continues to interfere with the file download.
It says: “Undefined index: ebd_downloads in /home/insidesc/public_html/wp-content/plugins/email-before-download/email-before-download.php on line 432” thus I checked the line 432 but it’s empty :/
I’m really confused, I don’t know what to do and I don’t find any php.ini
Any other idea?Thank you in advance,
LucaIt may be that your hosting company is forcing the debug stuff on. Let’s try one more thing. Put email-before-download.php back like it was before (unmodified .. back to the original). In your wp-config.php get rid of any stuff we added and then add this:
ini_set(‘log_errors’,’On’);
ini_set(‘display_errors’,’Off’);
ini_set(‘error_reporting’, E_ALL );
define(‘WP_DEBUG’, false);
define(‘WP_DEBUG_LOG’, true);
define(‘WP_DEBUG_DISPLAY’, false);and then try again. If that still doesn’t work, then you’ll need to contact your hosting company and ask them how to turn off PHP errors from displaying to the screen
As you can see, it still doesn’t work. But maybe something has changed: it shows two warnings:
(index):262 The specified value “Indirizzo email*” is not a valid email address.
But the email adress I wrote is ok.jquery.js:4 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help, check https://xhr.spec.whatwg.org/.send @ jquery.js:4
For this I really don’t know…Anyway, I’m going to contact my hosting company as you suggest and then I’ll write here their solution. I thank you so much dtynan for all your efforts ??
Those warnings/errors are from the Console part of Firebug or the Developer Tools and can be ignored for what we’re talking about. You actually still have the same problem. Nothing has changed. When you press Submit on your form a line will appear in Firebug/Developer Tools and if you click on that line (like where it says “trial-page/” or something like that) then the right side will change and you have some items you can click on. If you click on Response then you’ll see that you still have the exact same problem you started with where the “Notice ” junk is getting in there. That is the problem.
When you talk to your hosting company tell them you want to turn off display of PHP errors or make them go to a file and so far putting stuff in your wp-config.php doesn’t seem to have any effect .. where/how should you do it (maybe they have a menu item for it, maybe you’re modifying a file that isn’t getting pulled in or is being overridden somehow, etc).
[SOME UPDATE ON MY PROBLEM]
Hi dtynan,
I talked with my hosting company support and they tried all they could do to leave the error warning (notably they turned off the Debug as you can see here). Unfortunately, the error is still shown. Thus, I’m going to contact the email-before-download developpers and I will see if they can help me.Right now, by setting EBD in the Both option it correctly sends the e-mail with the file link but it doesn’t run the download.
Ok I can’t contact the EBD developpers because I can’t start a new topic in the support forum and I’m not able to send them a message from their company website. I’m quite lost as I lost a lot of time on this problem which isn’t still solved.
Finally, I’ll set the EBD on the send-email option and I’ll put in the contact form page a text like this: “don’t worry if you see the spinning arrow in loop, just check your e-mail (also in the spam) to find your file”. That is a sad solution but I don’t know a better way…
Ok, I may have this figured out…
It looks like you’re using SiteGround as your hosting company. I looked through their support knowledge base and found an article that has some comments on it that I think will help us get this fixed. The article isn’t perfectly on point, but the 9 comments below the article are pretty helpful:
https://www.siteground.com/kb/how_to_modify_php_settings_without_using_phpini_files/#commentsSo the SiteGround support people are basically saying that they force PHP to display all errors/warning/notices and you can’t turn it off by the normal methods like we trying (like where we tried putting the ini_set() commands in email-before-download.ph). Instead, you have to either use their “PHP Variables Manager” tool or you can make your own php.ini file and put it in the directory where you want it to take effect.
When you talked to the hosting people, did they try all that stuff already? You didn’t really say in your previous update. Anyway, here’s what I think you should do:
First, double-check your wp-config.php file and make sure that kind of near the bottom there is still this line:
define(‘WP_DEBUG’, false);
Note that needs to be before the line that says /* That’s all, stop editing! Happy blogging. */Ok, next, change EBD settings back to ‘inline’ rather than ’email’ so that we’ll be able to test and see if it fixes the issue.
Now, I don’t know if you’d prefer to use the PHP Variables Manager or if you want to do a php.ini for just the EBD plugin directory. That’s kind of up to you. I would probably just make a file and put just this 1 line in it:
ini_set(‘display_errors’,’0’);
and save that file and call it php.ini and the ftp it up to your site and put in the EBD plugin directory (wp-content/plugins/email-before-download).
Then start up a browser and go your EBD test page and try again and see if it works. If it works then I would add the following line to php.ini
ini_set(‘log_errors’,’1′);
and then test again and if it still works then you’re done and all is good (just remember that fro now on PHP errors are going to go to the normal error location for that server, which is probably accessible through something on your cpanel).
If doing the php.ini stuff I detailed above didn’t fix the problem, then do the following;
get rid of that php.ini file
go to your cpanel and go to PHP Variables Manager
you will get a screen that has a little tool to let you browse through the directory structure of your site.
using that little tool go to the wp-content/plugins/email-before-download/ directory
Now you’re gonna Add and for the variable name type in display_errors and then another field will appear for the value of that variable and you should put a 0 in there (that’s a zero). Then save it (don’t check the ‘apply to all subdirectories’ option).
now go test again and see if it works nowIt’s possible that the PHP Variables Manager tool really just writes out a php.ini. I couldn’t tell from the instructions if that’s all it did or if it worked in some other way. Anyway, it’s possible that it just writes out a php.ini (just like we already tried), in which case it probably won’t work just like it didn’t work when we make our own php.ini, but whatever, you can give it a try as a last resort.
Just to be clear, all of this seems to be the result of your hosting company’s rather silly defaults for their PHP error reporting. sigh.
Hello @lucapesci
I am part of the senior technical support team at SiteGround. Can you please let me know if you have already opened a ticket regarding the case? We might be able to assist you with the issue.
Please provide me with the ticket ID or open a new ticket describing the issue and steps to reproduce it:)
Hi dtynan. Thank you again for your support. Next week I’m going to try what you told me.
Hello Ivan Yordanov, I have already opened a ticket (ID: 2017082). Thanks for your interest!
lucapesci, I definitely think you should contact @ivanyordanov-1 via the ticket you have opened (or whatever). The fact that he responded on here is pretty impressive so maybe he can help. They are in a much better position to help with this than I am.
To be clear, the problem you are encountering is that PHP notices/warnings/errors are going to the screen. When a user clicks Submit on the EBD form you created, the user’s web browser does an AJAX POST and gets back JSON in the response. If you have those notices/warnings/errors going to the screen, then a notice will get mixed in with the JSON response, which basically corrupts the response and causes the page to hang (because the javascript on the page is expecting clean uncorrupted JSON and instead that notice is mixed in. All you need to do to fix the problem is make PHP notices/warnings/errors log to a file instead of going to the screen (or turn them off entirely). That’s it.
- The topic ‘No inline link, no email. Just loading in loop.’ is closed to new replies.