Support

Home Forums Event Espresso Premium changing thank you text

changing thank you text

Posted: August 23, 2016 at 1:53 pm

Viewing 11 reply threads


Joe Mangrum

August 23, 2016 at 1:53 pm

<?php
/*
Plugin Name: Site plugin for clairescreativeadventures.com
Description: Site specific code for clairescreativeadventures.com
*/
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */
function ee_proceed_to_button( $submit_button_text, EE_Checkout $checkout ) {
 if ( ! $checkout instanceof EE_Checkout || ! $checkout->current_step instanceof EE_SPCO_Reg_Step || ! $checkout->next_step instanceof EE_SPCO_Reg_Step ) {
  return $submit_button_text;
 } 
 if ( $checkout->next_step->slug() == 'payment_options' ) {
  $submit_button_text = 'Finalize Pre-Registration';
 }
 return $submit_button_text;
}

add_filter ( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_proceed_to_button', 10, 2 );

function ee_register_now_button() {
 return 'Pre-Register';
}

add_filter ('FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', 'ee_register_now_button');

function tw_custom_filter_gettext( $translated, $original, $domain ) {
 
    // This is an array of original strings
    // and what they should be replaced with
    $strings = array(
        'Ticket Options' => 'Registering For',

'The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.'=> 'The following event must be pre-approved to register. You will be notified when your registration has been processed. You will receive an invoice via email, or a response to your inquiry! PLEASE CLICK TO FINALIZE REGISTRATION',

        // Add some more strings here
    );
 
    // See if the current string is in the $strings array
    // If so, replace its translation
    if ( isset( $strings[$original] ) ) {
        // This accomplishes the same thing as __()
        // but without running it through the filter again
        $translations = get_translations_for_domain( $domain );
        $translated = $translations->translate( $strings[$original] );
    }
 
    return $translated;
}
 
add_filter( 'gettext', 'tw_custom_filter_gettext', 10, 3 );

/* Stop Adding Functions */

I use this as a plugin on the site website

Last night I added a new string

‘%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.’ => ‘The following event must be pre-approved to register. You will be notified when your registration has been processed. You will receive an invoice via email, or a response to your inquiry!’,

and it worked, then i edited and it failed??

‘The following Event(s) you have registered for do not require payment at this time and will not be billed for during this transaction. Billing will only occur after all attendees have been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.’=> ‘test’,

is another string I would like to use

not sure what happened but please help if you can??


Tony

  • Support Staff

August 24, 2016 at 4:54 am

When you say failed, what failed? It just didn’t translate the string or threw an error?

I tested your function with the additional translation added and it worked fine – http://take.ms/g1xX6

Here is the code used: http://pastebin.com/Hg678g3H


Joe Mangrum

August 28, 2016 at 10:22 am

‘The following Event(s) you have registered for do not require payment at this time and will not be billed for during this transaction. Billing will only occur after all attendees have been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.’=> ‘test’,

This section you see it says “test”

I’m trying this

‘Thank you for your interest! Please check your email within 24-48hrs for your online payment link.
If you prefer to mail a check to avoid CC fees, please send your check postmarked before 9/9/2016 to:
Claire’s Creative Adventures
10-38 47th Rd, Suite 6
Long Island City, NY 11101
(spaces filled in order in which payment is received.)
If paying by check, please do let us know, so that we may look for it while your registration is pending.’,

as a substitute for “test”

but it causes error on line 34??
is it too long? the above text is what I want on thank you page


Tony

  • Support Staff

August 29, 2016 at 7:22 am

It’s the apostrophe within Claire's, you need to either escape the apostrophe using a backslash, so Clairs\'s or switch the string to be wrapped in "..." rather than '...'

PHP thinks that apostrophe is the end of the string.


Joe Mangrum

August 29, 2016 at 12:34 pm

Your registration has been successfully processed.Check your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.’ => ‘The following event must be pre-approved to register. You will be notified when your registration has been processed. You will receive an invoice via email, or a response to your inquiry!’,

says the text encoding is wrong?


Lorenzo Orlando Caum

  • Support Staff

August 29, 2016 at 1:21 pm

Hello,

A formatted apostrophe can cause issues so if you are copying an existing phrase from a support post reply, then you’ll see that issue.

Also, that particular phrase has some placeholders that is not in your current text:

https://translate.eventespresso.com/projects/event-espresso-4/fr/event-espresso-fr_FR?filters%5Bterm%5D=Your+registration+has+been+successfully+processed&filters%5Buser_login%5D=&filters%5Bstatus%5D=current_or_waiting_or_fuzzy_or_untranslated&filter=Filter&sort%5Bby%5D=translation&sort%5Bhow%5D=asc

A gettext filter needs an exact match including any spacing to work.

After making the changes above, could you upload your current site specific plugin to a service like Dropbox or Gist (https://gist.github.com) so we can take a look?


Lorenzo


Joe Mangrum

August 29, 2016 at 1:37 pm

gist current custom

want to add translation


Lorenzo Orlando Caum

  • Support Staff

August 29, 2016 at 2:03 pm

Hi Joe,

Thanks and so we understand the current issue. The original one that you shared works but when you add the new entry then it does not?

The newest entry has some single quotes that are formatted. I referred to them as apostrophes earlier but I meant single quotes. Try removing those by deleting and then typing in a single quote from your keyboard.

You can see them here:

https://gist.githubusercontent.com/joemang1969/25425925e341949689024727469960ed/raw/0219cb0c44223c1a1643448beeacd4f63e490b6c/congrats%2520message%2520translation

Then you can add the new entry to your existing site specific plugin and it should work.


Lorenzo


Joe Mangrum

August 30, 2016 at 10:30 pm

whatI ended with

Thanks


Lorenzo Orlando Caum

  • Support Staff

August 31, 2016 at 6:37 am

Hi,

Is the updated version working for you or are you having trouble?


Lorenzo


Joe Mangrum

August 31, 2016 at 12:15 pm

Yes the translations seem to be working just looking at some final weeks and how to change the payment options text to “Finalize Pre-Registration”

and the button text to “Proceed to Finalize pre-Registration”

button


Lorenzo Orlando Caum

  • Support Staff

September 1, 2016 at 5:37 pm

Hi Joe,

Here is an example on how to change the messaging for the buttons that are available during registration checkout:

https://gist.github.com/joshfeck/f20b174e545e9ea983c6e955c18d6f2e

If you need help with anything else, then feel free to create a new support post (https://eventespresso.com/support/forums/) and a team member will share feedback.

Thanks!


Lorenzo

Viewing 11 reply threads

The support post ‘changing thank you text’ 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