Home › Forums › Calendar Products › Events Calendar PRO › Merge Tags – Need to merge specific event details into a auto-responder email
- This topic has 11 replies, 2 voices, and was last updated 8 years, 7 months ago by
ccg2017.
-
AuthorPosts
-
June 29, 2017 at 1:02 pm #1312562
ccg2017
ParticipantHi,
This may be out of support scope but if someone could shed some light on how to use merge tags to automatically pull an event’s details into an email (Ninja Forms) it would be much appreciated!
I saw another post that mentioned using get_post_meta( $event_id, ‘_your_custom_field_name’, true ); but I’m not sure exactly how the event ID would be defined.
Again, any direction on this would be fantastic.
Thanks
July 1, 2017 at 10:12 pm #1315157Jennifer
KeymasterHi Lindsey,
Thanks for reaching out!
We are a bit limited as to the support we can provide for customizations, but I will do my best to point you in the right direction and help you get this figured out. If you haven’t already, I would recommend taking a look at our themer’s guide, which has some great info on customizing our plugins, as well as this post on some of our functions.
First, could you provide a little bit more information as to how you would like this to work? You said you want to automatically pull event details into a Ninja Forms email…do you have a form set up on an event page that you want to send info on when someone completes the form? If this is the case, the global $post should be the event, in which case you can get the ID that way:
global $post;
$event_meta = get_post_meta( $post->ID );However, I think some of the functions I mentioned above may work better for you here. I hope that is helpful! Again, if you could give me a little bit more context here, I can probably give you some more specific recommendations!
July 2, 2017 at 8:45 am #1315255ccg2017
ParticipantHi Jennifer,
I really appreciate the help, I know it’s a bit of an oddball scenario.
If you visit this link and click “register for this seminar now” it launches a modal with a form.
What I’m trying to do is add some event details such as title date, time to the conformation email kicked out from the form.
What I think will work is to add a few hidden fields for that information, so that info can easily be inserted into the confirmation email.
What I need to figure out is how to capture the event details and have them inserted into the corresponding hidden fields when the “register for this seminar” button is clicked.
I don’t really need the post ID if the process can capture the pages details when the register button is clicked.
Thanks again.
July 2, 2017 at 9:12 am #1315261ccg2017
ParticipantI have a thought but my PHP isn’t strong so maybe you have a better idea.
I believe I can pre-populate the previously mentioned hidden fields with the following code:
?php // apply_filters('ninja_forms_render_default_value', $default_value, $field_type, $feild_settings); add_filter( 'ninja_forms_render_default_value', 'my_change_nf_default_value', 10, 3 ); function my_change_nf_default_value( $default_value, $field_type, $field_settings ) { if( 'textbox' == $field_type ){ $default_value = 'foo'; } return $default_value; }With that in mind, could you see how I would go about populating a field with the event title, for example using the functions? I believe the function for this is “tribe_get_events_title”.
Thanks
July 3, 2017 at 3:38 pm #1315654ccg2017
ParticipantAnother followup:
If I use the merge tag {wp:post_title} I am able to display the event title into the form. I am not however haveing luck with using the functions, something like {wp:tribe_events_title} or {querystring:tribe_events_title}. This may be the wrong usage for these but wondering if it sparks any thoughts on how to achieve this.
July 5, 2017 at 8:11 am #1316279Jennifer
KeymasterHi Lindsey,
Thanks for the clarification!
You might try using our new [tribe_event_inline] shortcode, which will let you embed specific single-event details onto a page…depending on how you have this setup, it might work for your email as well.
If not, some of our functions should work for you…tribe_get_start_date() for example. For info we don’t have a function for, you can use get_post_meta() or tribe_get_event_meta(). This article has some great info on the custom fields events have.
Let me know how it goes!
July 25, 2017 at 10:38 am #1325918ccg2017
ParticipantThanks Jennifer!
The [tribe_event_inline] actually works pretty well and has brought us a lot closer!
In the pop-up window, on page success message the content populates with all the proper info as we were hoping.
In the email however just the post id and the tags are being displayed.
Any ideas?
-
This reply was modified 8 years, 9 months ago by
ccg2017.
August 7, 2017 at 6:24 am #1331514Jennifer
KeymasterHi Lindsey,
So sorry about the delayed response here – this thread wasn’t showing up on my end as waiting on a response for some reason…
If the shortcodes aren’t working in the email template, the other option would be to use some of the functions that I mentioned before, like tribe_get_events_title and tribe_get_start_date. You can find a list of our available functions here, and our themer’s guide also has some great info on customizations like this one.
I do want to point out that if you are using the editor in your WordPress dashboard to edit the email template, you won’t be able to use PHP functions – you will need to use something like the filter method you mentioned before to pre-populate the fields, or edit the template files directly (some plugins like ours let you copy and paste the PHP template files into your child theme for editing there, but I’m not sure if Ninja Forms has a similar option).
Please let me know if you have any questions or need any help getting those functions to work! Apologies again for the delay, but I hope that helps!
Thanks,
Jennifer
August 7, 2017 at 8:13 am #1331588ccg2017
ParticipantNo problem Jennifer,
It’s actually figured it out most of the way! We’ve made an addition to the meta.php to register the functions we need as merge tags:
$venue_address = tribe_get_full_address ( $includeVenueName); add_post_meta( $event_id, 'event_address', $venue_address); add_post_meta( $event_id, 'event_date', $start_date); add_post_meta( $event_id, 'event_time', $time_formatted);Then in the email autoresponder they can be called like the below:
Title: {wp:post_title} Date: {post_meta:event_date} Time: {post_meta:event_time} Location: {post_meta:event_address}There seems to be two issues I’m working on now and if you have any suggestions it would be appreciated.
The resulting output (image attached) does not include the venue name and the line breaks on the location are unnecessary, so I would like to clean up the formatting.
Thanks
-
This reply was modified 8 years, 8 months ago by
ccg2017.
August 8, 2017 at 11:12 pm #1332649Jennifer
KeymasterHi Lindsey,
Glad to hear it’s almost there! Have you tried using tribe_get_venue()? This should return the venue name.
Regarding the formatting, I did some testing on my end, and the address returned by the tribe_get_full_address function is broken up into different span elements (see screenshot). I think the easiest solution would be to use CSS to display some of those classes as “inline-block”:
.tribe-locality, .tribe-delimiter, .tribe-region .tribe-events-abbr, .tribe-postal-code, .tribe-country-name {
display: inline-block;
}Let me know if that helps!
Thanks,
Jennifer
August 30, 2017 at 9:35 am #1342505Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
This reply was modified 8 years, 9 months ago by
-
AuthorPosts
- The topic ‘Merge Tags – Need to merge specific event details into a auto-responder email’ is closed to new replies.
