This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 2
Remove/exclude element from email sent to user
Started 13 years ago by ivycreekelementary | 13 posts |
-
I've looked around within the forums, but have been unable to find a question directly relating to/answering what I need to know.
I need to find out: is it possible to EXCLUDE a particular element from an email sent via MachForm (after someone has submitted their form), but still have the same sort of email sent using the default "{entry_data}"? Basically, I like the look of the email that is sent out when "{entry_data}" is set within the body of the outgoing email. However, one of the elements within our online form is sensitive security-wise and I would like for that information NOT to go out as part of the email being automatically sent to users who submit their form. Is there any sort of way to basically send the "{entry_data}" information, but leave out a particular element (e.g., "{entry_data}-{element_8}", sort of a full form - (minus) that element? Or a way to have that element be listed, but have the actual information entered by left blank or have "XXXXXXXXXX" instead?
It would be a HUGE help to know how to do this. I realize that I could, using the template variables option, create my own sort of email content that would leave out that element, but in my efforts thus far (with both "simple" and more "complex" HTML) I've not been able to duplicate the quality/look-and-feel of the email that is sent when {entry_data} is used.
Thank you very much in advance for your help!
Posted 13 years ago # -
If you don't want to use template variable, you need to edit "helper-functions.php" file for this customization.
To do this, go to around line 331 ~ 333 and you will see these code :if((empty($data['value']) || $data['value'] == ' ') && $data['value'] !== 0 && $data['value'] !== '0'){ continue; }
then put these code bellow that line
if ($form_id == 3) { if ($data['element_id'] == 2 || $data['element_id'] == 4 ) { continue; } }
that would remove element 2 and 4 entry data on form 3 mail notification. You can change those id with yours.
MachForm Support
Posted 13 years ago # -
Thank you VERY much for the prompt reply. I look forward to implementing this later today.
Posted 13 years ago # -
Hey all. I know this post is from a year ago but is it still valid in v3.4? Specifically I want to exclude one field from BOTH the email to the user and the one sent to me. Thanks.
Posted 11 years ago # -
If you are using v3.4, the code should be located around line 693:
if((empty($data['value']) || $data['value'] == ' ') && $data['value'] !== 0 && $data['value'] !== '0' && $data['element_type'] !== 'section'){ continue; }
you can put the same code as posted by Andar above, below that block of code.
MachForm Founder
Posted 11 years ago # -
Thanks I was able to find it but does this exclude the element in the email sent to me as well? Need it excluded in all emails sent out.
Posted 11 years ago # -
I also found that around 780 as well? Should I put the excludes on both?
Posted 11 years ago # -
You only need to put the code around line 780 if you are using the plain text email format.
MachForm Founder
Posted 11 years ago # -
Perfect thank you for the tips once again. Great learning.
Posted 11 years ago # -
This is great info - so thank you first and foremost. I was wondering if it's possible to take fields out of the generated email, but leave the fields in for the notification email?
As mentioned previously, it would be awesome to have a "show in email" option for each field. Or (even better!) the ability to choose whether or not to show the field data in the generated email AND/OR the notification email.
Thanks again!
Posted 9 years ago # -
This works great for removing the fields from the emails. It seems I can only remove 2 items at a time. This is ok, I just repeat the syntax with different values as many times as I need for each form. If I do more than 2 at a time, machform stops loading all together.
Posted 9 years ago # -
ResidTav -- If you're using version 4 already (or even v3), you can do that easily by customizing the email content template.
Currently, the email content template is only using a single template variable
{entry_data}
which will display all the fields.
You can display individual values of each field by using the template variables (such as: {element_1}, {element_2} and so on)MachForm Founder
Posted 9 years ago # -
Still valid in v4.8 however it would be nice to have a choice on the form to show "do not include element in email" or similar. I edit the helper file as some of my forms have hundreds of elements so for me it is easier.
Posted 8 years ago #
Reply
You must log in to post.