Jump to content

Modify body of Ninja Forms email.


Recommended Posts

I'm attempting to modify the email message body based on a users input to a form. I'm using the code shown here as a starting point: https://stackoverflow.com/questions/40345116/manipulate-ninja-forms-mail-body?answertab=votes#tab-top Unfortunately even the most rudimentary change to the message body does not seem to work, and I'm unable to find any additional documentation on the ninja_forms_action_email_message filter. Has anyone attempted to modify the email message body upon submission?

 

Here's what I'd like to achieve. If the user submits "Yes" to a question, then I would add a list item to the body of the email I send them. If they answer "No", then no list item would be added.

 

Thanks so much!

~Sarah

Link to post
Share on other sites

Yes, we need to see code. Obvious questions:

 

-Do you have a token in the email template to replace with your ul or ol code?

 

What does the form data look like when a user chooses yes? Is it a checkbox, dropdown, what?

Link to post
Share on other sites

From the source code, it looks like the first passed parameter is the message and the second is an array of user-submitted form data. You should be able to check the second parameter for the status of your yes/no question, then update and return the message at that point. BTW - you'll find the filter definition in the includes/Actions/Email.php file.

Link to post
Share on other sites
This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.