Skip to content

Instantly share code, notes, and snippets.

@lorenzocaum
Last active September 12, 2015 19:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lorenzocaum/b4bbd1bb839a1c80b2b4 to your computer and use it in GitHub Desktop.
Save lorenzocaum/b4bbd1bb839a1c80b2b4 to your computer and use it in GitHub Desktop.
Change the word ticket to registration on Event Espresso 4 event and registration pages.

As of Event Espresso 4.8.8, this is no longer needed as the word "ticket" has been removed from the single event pages.

<?php
//* Do NOT include the opening php tag

//* Change messaging for ticket to registration
function ee_change_ticket_messaging_registration( $translated, $original, $domain ) {

    $strings = array(       
		//'Available Tickets' => 'Available Registrations',
    //' / ticket' => ' / registration',
		//'Details' => 'Registration Details',
		//'Sale Dates' => 'Registration Sale Dates', 
    //'Please note that a maximum number of %d tickets can be purchased for this event per order.' => 'Please note that a maximum number of %d registrations can be purchased for this event per order.',
    'The dates when this option is available for purchase.' => 'The dates when this registration is available for purchase.',
		'This option allows access to the following event dates and times. "Remaining" shows the number of this ticket type left:' => 'This registration allows access to the following event dates and times. "Remaining" shows the number of this registration type left:',
    //'Sold' => 'This Registration<br/>Sold',
    //'Remaining' => 'Registrations Remaning',
    'Total%sSold' => 'Total Registrations<br/>Sold',
    'You need to select a ticket quantity before you can proceed.' => 'You need to select a registration quantity before you can proceed.',
    'No tickets were added for the event.' => 'No registrations were added for the event.',
    'Name and Description' => 'Registration Name and Description',
    'The following checkboxes allow you to use the above information for only the selected additional tickets/attendees.' => 'The following checkboxes allow you to use the above information for only the selected additional registrants/attendees.',
    );

    if ( isset( $strings[$original] ) ) {
        $translations = get_translations_for_domain( $domain );
        $translated = $translations->translate( $strings[$original] );
    }
 
    return $translated;
}
 
add_filter( 'gettext', 'ee_change_ticket_messaging_registration', 10, 3 );

//* Additional changes to messaging for ticket to registration
add_action( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', 'ee_additional_change_ticket_messaging_registration_a' );
function ee_additional_change_ticket_messaging_registration_a() {

 return 'Registration Price Breakdown';
}

//* Additional changes to messaging for ticket to registration
add_action( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', 'ee_additional_change_ticket_messaging_registration_b' );
function ee_additional_change_ticket_messaging_registration_b() {

 return 'This registration allows access to the following event dates and times.';
}

//* Additional changes to messaging for ticket to registration
add_action( 'FHEE__registration_page_attendee_information__attendee_info_not_required_pg', 'ee_additional_change_ticket_messaging_registration_c' );
function ee_additional_change_ticket_messaging_registration_c() {

 return 'This registration type does not require any information for additional attendees, so attendee #1\'s information will be used for registration purposes.';
}

//* Additional changes to messaging for ticket to registration
add_action( 'FHEE__registration_page_attendee_information__auto_copy_attendee_pg', 'ee_additional_change_ticket_messaging_registration_d' );
function ee_additional_change_ticket_messaging_registration_d() {

 return 'The above information will be used for any additional registrants/attendees.';
}

//* Additional changes to messaging for ticket to registration
add_action( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', 'ee_additional_change_ticket_messaging_registration_e' );
function ee_additional_change_ticket_messaging_registration_e() {

 return 'Total Price';
}
@lorenzocaum
Copy link
Author

This alternative version will change references to ticket to entries.

<?php
//* Do NOT include the opening php tag

//* Change messaging for ticket to entry
function ee_change_ticket_messaging_entries( $translated, $original, $domain ) {

    $strings = array(       
        'Available Tickets' => 'Available Entries',
        ' / ticket' => ' / entry',
        'Ticket Details' => 'Entry Details',
        'Ticket Sale Dates' => 'Entry Sale Dates', 
        'Please note that a maximum number of %d tickets can be purchased for this event per order.' => 'Please note that a maximum number of %d entries can be purchased for this event per order.',
        'The dates when this ticket is available for purchase.' => 'The dates when this entry is available for purchase.',
        'This ticket allows access to the following event dates and times. "Remaining" shows the number of this ticket type left:' => 'This entry allows access to the following event dates and times. "Remaining" shows the number of this entry type left:',
        'This Ticket<br/>Sold' => 'This Entry<br/>Sold',
        'This Ticket<br/>Left' => 'This Entry<br/>Left',
        'Total Tickets<br/>Sold' => 'Total Entries<br/>Sold',
        'You need to select a ticket quantity before you can proceed.' => 'You need to select an entry quantity before you can proceed.',
        'No tickets were added for the event.' => 'No entries were added for the event.',
        'Ticket Name and Description' => 'Entry Name and Description',
        'The following checkboxes allow you to use the above information for only the selected additional tickets/attendees.' => 'The following checkboxes allow you to use the above information for only the selected additional entries.',
    );

    if ( isset( $strings[$original] ) ) {
        $translations = get_translations_for_domain( $domain );
        $translated = $translations->translate( $strings[$original] );
    }

    return $translated;
}

add_filter( 'gettext', 'ee_change_ticket_messaging_entries', 10, 3 );
<?php
//* Do NOT include the opening php tag

//* Additional changes to messaging for ticket to registration
add_action( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', 'ee_additional_change_ticket_messaging_registration_a' );
function ee_additional_change_ticket_messaging_registration_a() {

 return 'Entry Price Breakdown';
}

//* Additional changes to messaging for ticket to registration
add_action( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', 'ee_additional_change_ticket_messaging_registration_b' );
function ee_additional_change_ticket_messaging_registration_b() {

 return 'This entry allows access to the following event dates and times.';
}

//* Additional changes to messaging for ticket to registration
add_action( 'FHEE__registration_page_attendee_information__attendee_info_not_required_pg', 'ee_additional_change_ticket_messaging_registration_c' );
function ee_additional_change_ticket_messaging_registration_c() {

 return 'This registration type does not require any information for additional entries, so information from the first entry will be used for registration purposes.';
}

//* Additional changes to messaging for ticket to registration
add_action( 'FHEE__registration_page_attendee_information__auto_copy_attendee_pg', 'ee_additional_change_ticket_messaging_registration_d' );
function ee_additional_change_ticket_messaging_registration_d() {

 return 'The above information will be used for any additional entries.';

//* Additional changes to messaging for ticket to registration
add_action( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', 'ee_additional_change_ticket_messaging_registration_e' );
function ee_additional_change_ticket_messaging_registration_e() {

 return 'Total Price';
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment