Skip Navigation

[Resuelto] Can't send a notification email to the post author of current post page

This support ticket is created hace 4 años. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Este tema contiene 8 respuestas, tiene 2 mensajes.

Última actualización por Nigel hace 4 años.

Asistido por: Nigel.

Autor
Mensajes
#1828329
Screen Shot 2020-10-29 at 3.00.34 AM.png

Hello!

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

https://toolset.com/forums/topic/contact-form-to-post-author/
https://toolset.com/forums/topic/email-not-sent-to-post-author-when-form-is-submitted/

Any help appreciated! Thanks!

#1828741

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Hi Conrad

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.

I'll update you again.

#1828779

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.

Thanks!!
Conrad Stel

#1829875

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Screenshot 2020-10-30 at 15.27.40.png

Hi Conrad

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.

#1829889

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Sorry Conrad.

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.

#1830853

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.

Really appreciate the help

#1831713

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Hi Conrad

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.

If you use shortcodes in your notifications beware a gotcha that for deferred notifications (sent later than when the form is submitted) you need to add an item attribute to anchor the notification to the correct post, see https://toolset.com/course-lesson/send-notifications-when-someone-submits-the-form/#displaying-post-information-in-notifications

#1832643

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.

Cheers

#1833323

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

OK, glad to have been able to help.