Posted: January 9, 2025 at 11:17 am
I’ve search the forum and see that a couple people have asked similar questions in years past and the answer was no, but then I found this post and now I’m not sure: https://eventespresso.com/topic/acf-field-on-automated-emails/ Can I have ACF Data spit out into the Message templates? |
|
Hello Fella’s – Any news for me on this question? |
|
Hi, Apologies! I thought I’d replied to this! The answer is yes and no (That’s a great answer that, Tony! π ). ACF is ‘just’ storing custom fields with a post type, so technically EE can already pull in those values using the https://monosnap.com/file/Fujbw8EHs8YhqcxdlQqCodUgBBxhRG And the shortcode would just be:
The output in that specific case would be ‘Testing’. The ‘problem’ is that ACF also does a bunch of other processing and allows for wayyyyy more custom field types than WordPress does and that’s where you’ll run into problems becuase EE doesn’t know anything about ACF i itself, so the value you get back from ACF may not be the value you expect (it may store the ID of some value from a custom table within the custom field and then have say a Date stored with that ID) ACF knows how to pull the correct data, EE will not. So yes, as it stands EE will indeed pull ‘a’ value for an ACF field is you pass it the correct custom field meta_key for it… but if that’ll be the correct field is another story. To pull the correct field another shortcode needs to be created that will pull in the value in the way that ACF wants it to be done, if that’s a hard requirement for you its something we may be able to do with 1/2 support tokens (will need to asses how long it will take before moving forward). |
|
I would love to get an estimate. I’m getting some clarifications from PFI on what that data looks like. I know it will be text and html links to some files. It could all get dumped into a text-area ACF element I believe. What I don’t know is if that data would then get sent attached to the Registration Approval message or the (as yet to be setup) Reminder email that gets sent out. Not sure if that makes any difference. Thanks for looking into costs Tony! |
|
Hey Tony – do you have any information for me on this – PFI would love to have this functionality testing by next week if possible. Please let me know. In the meantime, I’m going to create the ACFs where we will store data – and I can provide you access to our Staging environment (let me know how to do that privately). |
|
Hi Shelly, My apologies, I think I misunderstood your previous reply here. I was waiting on more details based on this:
I need to know which data types we are working with to be able to answer this. If you have the ACF fields set up I’ll take a quick look and let you know. Just send temp login details over using this form: |
|
Oh! Brilliant. Sorry about that – okay. So I just sent it over… The email we’d ideally like this info to go into is the Primary Registrant Registration Approved email… I think… I should say that I’m not 100% sure the difference between the Primary Registrant and just Registrant emails – so if its easier to go into one or the other, I guess I need to better undstand that. I “THINK” we just use the Primary Registrant email message. |
|
Ok, thank you, I can see it. You’re looking at roughly an hour to code and test his so it would be 2 Support Tokens and I should be able to get that done today/tomorrow depending on when/if you give the thumbs up. The shortcode should allow you to pull most ACF fields into the email content, spring an edge cases, but text fields your using now would be fine. |
|
Ok – I’m going to go ahead and pay for this, but I just need to reiterate that we have both text and links (so that’s why I chose the WYSIWYG ACF element intstead of just the text one). The information we’re including in the Registrant Email is both text and links. Thank you!! |
|
Huh? Sorry, I don’t follow. What is the difference between text and links here? Links are basically just text in a specific format that your browser can understand. So:
and….
Both should output fine within the message template from a WYSIWYG ACF element. |
|
Sorry to make it complicated. I’m working with people who don’t know how to add the html for a text link but can link something in word and then cut and paste it into the field… so a basic text only element for ACF would lose the link portion and just show the text when cutting and pasting from word. But if the element is a WYSIWYG one, then that href will reamin attached and functioning. |
|
Ohh, sorry now I follow. Ok so I have this ready to go; where would you like for me to add it? I can package it up as a separate plugin or would you like it somewhere specific? |
|
Ooooo good question. A separate plugin sounds smart. If that’s not too much work Tony? THANK YOU!!! |
|
Hi Shelly, Apologies for the delay, I asked one of our developers to review before adding to the site just to be sure (all good). I’ve add the function to a custom functions plugin on the site and it now adds a You just pass the field name to the shortcode after the *, so for example you have an ACF field for ‘Class Must Knows’ wand the field name for that in ACF is
That will pull the details from that field into the message for you. Please do let me know if you run into any issues. |
|
FANTASTIC!!! Thanks for being thourough and careful. I appreciate you! |
|
You’re most welcome π Please do let me know if you run into any issues. |
|
Hey Tony – can I nest ACF shortcodes into this new ACF field you helped connect up to our Email Messages? So for example, I created a “Supply List” link in ACF and attached it to each class, but students can only get to this when the class is still up and accepting reservations – once the class has started, there is no way for them to get to the supply list – HOWEVER… I could maybe stick it in this new “What_you_need_to_know” ACF field you helped me with. There are a few custom fields I’d love to buy default include. Thank you! |
|
Hi Shelly, Hmmm, I don’t think you can no (that’s an ACF feature question rather than this snippet as your trying to nest ACF fields within ACF fields and the snippet just uses get_field to pull in the value). But.,.. unless I’m misunderstand, wouldn’t you just include another shortcode to pull in that acf field?
Would that not work? |
|
Ohhhhh so you mean that you provided the ability for me to pull ACF stuff into the email – Then YES!!!! Oh Holy cow, I’m a dork. Thanks much Tony!!! |
|
TOny – I tried to do that – it did not work. I added this: To the Event List section of the message. The oringinal one you worked with still worked but these two new ones did not. These 2 ACF fields are part of a different Field Group, which has multiple separate fields – whereas the one you helped me set up (what you need to know) is the only field in that particular field group. Could that be the issue? Just spit balling. Thanks – sorry to be such a royal pain in the ass. |
|
TOny – I tried to do that – it did not work. I added this: To the Event List section of the message. The oringinal one you worked with still worked but these two new ones did not. These 2 ACF fields are part of a different Field Group, which has multiple separate fields – whereas the one you helped me set up (what you need to know) is the only field in that particular field group. Could that be the issue? Just spit balling. Thanks – sorry to be such a royal pain in the ass. |
|
Hmmm, which event and which message template are you editing? I’ll take a look on the site.
That shouldn’t matter, each individual field is still just a field. The groups allow you to organize them better. |
|
It’s the same, [EVENT_LIST] |
|
Which template are you editing though? I can’t see your shortcodes it in the default templates, so I’m assuming your using a custom template? For which event? I currently don’t know where to look to see what changes you are making. |
|
Oh I’m a dork. Sorry Let me test registering again tho… just in case it was a cache issue… |
|
Yeah there is something weird going on… a lot of my updates are not show. Hold off doing anytyhing for now – maybe I’m getting Primary Registrant and Registrant templates confused. Let me duplicate my changes to both and dump server cache and retry… sorry Tony! |
|
I am such a dork. I was testing the wrong email. THANK YOU – all working. Pleae ignore me… |
|
This reply has been marked as private. | |
Well, I’m not 100% sure I understand however, I can say that the only “Unique” parts of what is now our default Approved Registration Message Templae, are only those things being caught by the ACF fields. All that other stuff is meant to get sent to all students who register for any old class. So the only Unique info will be the ACF fields (which are edited at the Event Level). If we have to create unique Messages for each class, then it defeats the purpose of creating those ACF fields in the first place -I’d just add that stuff to the template instead. Am I wrong? Do I need to revert? -S |
|
Oh, so all of your events use those ACF fields and will have their own values for those? I’m not saying don’t use the ACF shortcodes, I assume only some of your events pulled values for those, but if they are used on all, then you can ignore me as yes, that’s what they are for π |
|
Yes! Whew! That was a close one! π Thank so much Tony!!!! I think we got it working! |
|
Awesome, I’m glad its working and you’re most welcome π |
|
You must be logged in to reply to this support post. Sign In or Register for an Account