I'm trying to get the email generated by filling out a Post Form to include a total count of a specific of custom post type.
I've created a view that uses [wpv-found-count] to return the total number of custom posts, and inserted that view into the E-Mail Notification of a Post Form. The email sends but the problem is this line:
You are the X person to sign
X should be the number, and is where the view is placed, but just returns a blank.
How can I create a view that returns the actual number so it can be inserted into the email?
Hi, let me ask my 2nd tier support team about this. It seems like a View placed in the notification should show results, but I cannot get that to work consistently. I'll let you know what I find out.
Thank you Christian, that's a good summary of the problem.
Just a quick update to let you know we're still working on this and I'll update you when I have more information to share.
Thanks, let me know If you need anything or would like site access to see anything.
Any progress on this? Are there any special considerations when putting a View in the body of an email?
We're still investigating this, thanks for your patience. Most of the special considerations are based on context, like if you have a Query Filter set up to filter by the current User or by the terms of the current post. When an email is sent there is no context like that, so the results can be unexpected. However, I'm not aware of any special considerations for your particular case. I'm waiting to receive additional information about this, because my 2nd tier team is experiencing the same inconsistent behavior I have experienced during testing.
I didn't realize I'd caused such an incident! The view I created had no filters or conditions at all. It just looped through a simple custom post type. The post type has no relationships and only collects a few pieces of information in it's custom fields. Let me know if you'd like access to see it in action.
It seems there is a problem and we need to fix it - you didn't cause anything. The View we're using is very simple as well. No filters or special shortcodes, just a loop over posts that displays the post title. Sometimes it works, other times it does not. It's not obvious yet why there is inconsistency, but I'll let you know what I find out.
Christian,
I wanted to check in and see if you have found anything on this yet?
Hi, yes we were able to identify the issue and add the fix to the next version of Forms. We're tentatively planning to release that update tomorrow, but most certainly within the next few days. I'll keep you posted here. Once that release is out, you should be able to use a View to display a count in the email notification.
Things are looking better with the update! But there is still an error that I'm getting.
I'm using a plugin called Social Warfare which injects social media sharing buttons to the bottom of pages. It is adding it's html to the bottom of the view that is sent out via email. The plugin has settings where I can choose which post-types I can add it to, and it will automatically inject itself into the top or bottom. I've got everything deselected, so it doesn't show up anywhere else on the site, yet it's still showing up in the view when sent via email. The Social Warfare settings don't see the Views so it's not showing up in their settings. An interestingly, when I tell the Post Form to send a test email, the Social Warfar injected code does NOT show, only when someone fills out the form.
That sounds like a conflict specifically with the Social Warfare plugin. I'll split that into a separate ticket so we can investigate in more detail.