Posted: August 8, 2019 at 1:34 pm
I am editing the default email that sends – the approval pending Email Notification, and I thought I had done it correctly.
However when I test it, only SOME of the email body shows up in the email.
I don’t know why it is omitting parts of the email.
We discovered recently that even though we are selecting a CUSTOM email to be sent when someone registers, it is NOT always sending the selected email, but reverts to the default approval pending email, which I’d like to change to match the selected email we use in the drop down. That way it will not matter what they get – it will be the right email content.
But in editing the custom_functions.php file it doesn’t seem to output the entire body of the email.
This is the new code I have edited for the email:
This is the text it generates in the actual email received – FYI The subject text comes through correctly, but as you can see it is missing the first 5 paragraphs or so of the email content:
We also require a copy of your vaccination record. Please also submit a photo copy/scan of the most recent vaccination record to us either via email or by mail with your waiver form. Note: all payment and paperwork must be submitted IN ADVANCE of the first class, and NOT brought on the first class. If you wish to provide us the waiver and vaccination records in person, please do so before Wednesday, August 7, 2019.
Once payment is received, and all waiver and vaccination records are provided, your class spot is reserved for you.
Thank you for choosing All About Dogs
The All About Dogs Team
Can you please help me figure out what is wrong with the custom file. I have put the old one back temporarily, but since we have issues with the custom email being sent, I’d really like to get this fixed asap.
A few examples where you didn’t concatenate the $body string follow:
Josh, I have little skill in php. I tried what you said and it broke the entire site and things were bad, very bad. Had to deactivate everything and reinstall EE and the custom files plugin, and reinstall old custom_function.php file used solidly for years prior to this edit. Any chance you can actually have a look at the entire php section and make sure nothing else is messed up in it and resend the correct version? I am no expert in php, but we HAVE to get this fixed because the CUSTOM EMAIL drop down selection that we use for EVERY SINGLE REGISTRATION does NOT always get emailed and it falls back to this default, and it needs to match the custom one, if we can get it to match then we don’t have to use custom one every time.
Can you please help.
You tried what I said? I didn’t actually say to do anything specific, other than point you in the direction of the PHP manual, and point you to where you have a few errors in your code.
I’ll try to help you by pointing out a few more specific errors in your code and how they can be fixed. Please understand though, it’s not my place to support or rewrite code that was not developed by Event Espresso staff. Specific code change suggestions to follow in the next replies.
The first error is on this line:
I can advise to change the above to:
You’ll note that in the above change, the $body variable is no longer reset, and instead added to (or concatenated). Also, there’s no need to wrap your custom text with a localization function. Your code will be simpler to maintain without them. Finally, please note the formatting. When each variable is on its own line, your code will be easier to maintain/debug/read and so on.
The same problem occurs later with:
I can advise to change to:
In a nutshell, the