[Gelöst] Can't send a notification email to the post author of current post page
This support ticket is created vor 4 Jahren, 1 Monat. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.
In summery, I can't send a notification email to the post author of the post that the contact form is on.
Love the plugin but I can't seem to get your forms to work as a contact form. I have a custom post type called an Agent, and I want the form filled out on that agent's page to send an email notification with the form info to that agent. I thought I could do this by setting the notification to go to the post author but my understanding is that it would then go to the person filling out the post form instead.
So I've tried both your own and beaver builder shortcodes (which the site is built with) but none of my shortcodes seem to work, and I've tried two code examples from your support teams in other threads found below but neither of them work, or even return an email value within the email when I check. Attached a screenshot from the email and what its putting out for the given code as well
You should find, if you insert a form on a page, that if you include the wpv-post-author shortcode somewhere in the form, the author it outputs will be the author of the page where the form is displayed (that's the context).
You can output the email of that author with the following shortcode:
[wpv-post-author format='meta' meta='user_email']
But when I checked just now, it seems that if you add a generic email field to the form, you can't use that email address for the form notification.
The notifications allow passing the ID of the user that should receive the notification as a generic field.
Hmm. But testing that, it doesn't appear to be working, and in any case there isn't a shortcode to directly output the ID (rather than name or similar fields).
Let me see if I can get this working and I'll get back to you. I suspect I may need to register a custom shortcode at least.
Okay great, please let me know. I originally built the contact form in CF7 but saw that your system could make contact forms so I assumed this would be a standard feature for a directory site. How does one normally contact a seller of a product otherwise?
I know I can do this in formidable forms or gravity but I'd rather not add more plugins and spend more to do what toolset already can.
I re-checked the possibilities, and you can't do this without registering a custom shortcode. (I'm filing a usability ticket internally, as it should be possible.)
You need to add a hidden generic field to your form, making sure it is available in form notifications, where the default value comes from a custom shortcode you will register, authorid (see screenshot).
Then add the notification, where it is sent to the user specified by that same generic field.
Now go to Toolset > Settings > Custom Code and add the following as a code snippet, being sure to activate it:
add_shortcode('authorid', function () {
global $post;
return $post->post_author;
});
The notification will then be sent to the author of the page where the form is displayed.
I was just creating that internal usability ticket, and I realised you can do this without registering a custom shortcode.
This Views shortcode will provide the user ID of the post author:
[wpv-post-author format='meta' meta='ID']
I had somehow overlooked ID as a possible option for the output of that shortcode.
So the steps are essentially the same, but rather than register and use the custom shortcode, simply use this shortcode to provide the default value for the generic field in your form that is used for the notifications.
Hey! This worked fantastically. I actually used the shortcode before but didn't realize you had to have that legacy plugin installed. Why is it legacy? Do you have something new coming to replace it? It made a MASSIVE difference for the notification emails too, my forms are all custom fields and the %%FORM_DATA%% and other placeholders are so restrictive.
You need either Blocks or Views active, they are essentially the same plugin, but default to either the old shortcodes-based UI (Views) or the new blocks-based UI (Blocks).
With either installed, you can go to Toolset > Settings and choose which UI to expose, including both. I'd recommend you have Blocks installed, then change the settings as required.
Ah Okay, unfortunately installing blocks currently breaks Beaver Builder. And as great as this new system you're building seems, it can't replace beaver builder for us. And from what I understand you're building blocks because of these incompatibilities so I can't see that changing anytime soon. Thanks for all of your help though. This has made things much easier.