Excellent, thanks for this. But the additional fields cannot be integrated in the RSVP notification mail though, the fields are not shown when I add them to the RSVP template. How can that be done?
I'd like add additional fields in the RSVP form. That worked well with the code you've provided. Now, when I try to implement the new fields in the RSVP-Mail-Template (the one that is editable behind the text "Notify author when new attendee has been added via RSVP"), then it won't appear in the mail.
It looks like this:
Registration for {{title}} on {{attend_date}} Attendee: {{attendee}} Additional Field: {{addfield}}
The Mail I get looks like this:
Registration for Compliance Presentation on 2023-04-17 Attendee: Robin Heizmann Additional Field: {{addfield}}
You can use this hook to register {{addfield}} placeholder.
add_filter('stec_send_event_author_new_attendee', function ($data, $event, $attendee) {
// adds {{addfield}} special word
add_filter('stec_mail_add_special_words', function ($filter) use ($attendee) {
$filter['replace'][] = '{{addfield}}'; // the special word placeholder
$filter['with'][] = $attendee->get_custom_data('addfield'); // meta key
return $filter;
}, 10);
return $data;
}, 10, 3);
Usually this code is placed in the theme or child-theme functions.php file.
Excellent, that works well, thanks a lot. Last question: I'd like to have the RSVP-notification sent to multiple email-addresses, where can I register them?
Follow-Up question: When a required field is not filled out, the form cannot be sent. So far so good, but it doesn't show a "required field"-notification. Where can that be implemented/forced?
The problem just popped up again: the custom fields in the RSVP-form are not sent by mail. The code you've provided does not work anymore, the fields are blank in the mail:
add_filter('stec_send_event_author_new_attendee', function ($data, $event, $attendee) { // adds {{addfield}} special word add_filter('stec_mail_add_special_words', function ($filter) use ($attendee) { $filter['replace'][] = '{{addfield}}'; // the special word placeholder $filter['with'][] = $attendee->get_custom_data('addfield'); // meta key return $filter; }, 10); return $data;
}, 10, 3);
Hey
Fantastic plugin, I love it!
Question: Is there a way to customize the RSVP form? Add additional fields and name-fields for the amount of people indicated?
Cheers, Robin
Hi,
It's possible to add extra fields via custom hooks.
You can check out this article.
https://stachethemes.ticksy.com/article/16037/
Stachethemes Developer
Excellent, thanks for this. But the additional fields cannot be integrated in the RSVP notification mail though, the fields are not shown when I add them to the RSVP template. How can that be done?
Could you elaborate what you want to achieve?
It's possible to register extra special {{words}} for the template but I'll need to know for which email template are you talking about.
Stachethemes Developer
I'd like add additional fields in the RSVP form. That worked well with the code you've provided. Now, when I try to implement the new fields in the RSVP-Mail-Template (the one that is editable behind the text "Notify author when new attendee has been added via RSVP"), then it won't appear in the mail.
It looks like this:
Registration for {{title}} on {{attend_date}}
Attendee: {{attendee}}
Additional Field: {{addfield}}
The Mail I get looks like this:
Registration for Compliance Presentation on 2023-04-17
Attendee: Robin Heizmann
Additional Field: {{addfield}}
You can use this hook to register {{addfield}} placeholder.
Usually this code is placed in the theme or child-theme functions.php file.
Stachethemes Developer
Excellent, that works well, thanks a lot. Last question: I'd like to have the RSVP-notification sent to multiple email-addresses, where can I register them?
You could modify the mail headers via stec_wp_mail_headers filter.
e.g.
Stachethemes Developer
Ah thanks, and how can I make the additional fields mandatory?
Add required="required" attribute to the input field:
Stachethemes Developer
Excellent, thank you!
Follow-Up question: When a required field is not filled out, the form cannot be sent. So far so good, but it doesn't show a "required field"-notification. Where can that be implemented/forced?
I will add better alerts for the required fields in the coming days.
Meanwhile you could use this hook:
It overrides the default verification method and shows a toast when required fields are missing.
Stachethemes Developer
That works perfectly well, thanks a lot!
Hi again
The problem just popped up again: the custom fields in the RSVP-form are not sent by mail. The code you've provided does not work anymore, the fields are blank in the mail:
Any ideas how to make it work again?
Thanks, Robin