Support

Home Forums Event Espresso Premium Change thank you text, but only for certain events

Change thank you text, but only for certain events

Posted: February 3, 2021 at 10:47 am

Viewing 3 reply threads


Antenna Digital

February 3, 2021 at 10:47 am

In this topic: https://eventespresso.com/topic/change-text-on-the-thank-you-page/
It’s well described how to change the text in the yellow bordered box on the thank you page.

My client’s site uses Advanced Custom Fields to ‘identify’ different kinds of events. ie: Conference, Training, or Webinar.

The regular message is fine for Conferences and Training, but they would like to have a different message if the event is a Webinar.

In the topic above, I don’t quite understand how to access a specific ACF field within the function.

In other modifications we’ve done, like adding hotel information or training docs below the yellow box, I’ve used this approach:


function ee_course_materials_section_thank_you_page( $registration ) {
if ( $registration instanceof EE_Registration ) {

if( get_field('hotel_link', $registration->event()->ID()) && $registration->status_ID() === EEM_Registration::status_id_approved):
?>
.......etc

And this works great.

But I don’t think I can use get_field(‘event_type’, $registration->event()->ID()) in the mycustom_filter_gettext() function as I don’t know if $registration is available. Or what other reference I can use.

Can you help?
Dave


Tony

  • Support Staff

February 3, 2021 at 2:57 pm

Hi there,

So, the get_text filter isn’t passed the EE_Registration object, but it would be possible to pull it from the request. However, there are other filters on the thank you page that make this a little easier to do.

AHEE__thank_you_page_overview_template__top is fired at the top of the thank you page and that is passed the EE_Transaction object. You can than use that to pull the event from and add a filter onto the thank you text.

Something like this:

https://gist.github.com/Pebblo/0b4db49d27b00c4a68403c81e40e7452

Does that help?

That example will change the thank you text to whatever is returned from tw_filter_thank_you_text_based_on_event if the event has a custom value with key change_thank_you which returns a truthy value so should give you an idea of how you can do this.


Antenna Digital

February 4, 2021 at 6:50 am

Thanks Tony, that does the trick nicely.


Tony

  • Support Staff

February 4, 2021 at 7:01 am

You’re most welcome.

Viewing 3 reply threads

The support post ‘Change thank you text, but only for certain events’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso