Support

Home Forums Event Espresso Premium Event registration page – Add More Attendees

Event registration page – Add More Attendees

Posted: July 29, 2016 at 7:29 am

Viewing 14 reply threads


Maccabee Levine

July 29, 2016 at 7:29 am

Is it possible to change the language for adding more people to:

Register Additional Attendees Click Here

and omit (click to toggle, limit #)


Lorenzo Orlando Caum

  • Support Staff

July 29, 2016 at 11:33 am

Hello,

That is translation ready using a gettext filter (https://eventespresso.com/wiki/how-to-change-wording-with-poedit/#custom-function). Here is the source text:

Add More Attendees? (click to toggle, limit %s)


Lorenzo


Maccabee Levine

July 29, 2016 at 11:56 am

So does this code currently exist in one of your files or do I add this code to custom_functions.php


Lorenzo Orlando Caum

  • Support Staff

July 29, 2016 at 12:02 pm

Hello,

We do not recommend editing the core software. This is because customizations will be lost upon a software update.

A gettext filter can be added to a site specific plugin (https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/) or through a child theme’s functions.php. Both of those are safe locations and won’t be lost on a software update.

If you have an existing gettext filter in use, then you could add a new entry for the text that I shared.

Here are some other examples of gettext filters:

https://gist.github.com/lorenzocaum/82523b3d032879b58e6c

https://gist.github.com/433446065b3bb5d50c71


Lorenzo


Maccabee Levine

July 29, 2016 at 12:11 pm

I have not filters in place (didn’t know that they existed). This is kind of out of my comfort zone. Just to be clear, I have a custom_functions.php file under /wp-content/uploads/espresso which doesn’t effect the core or is it easier to find a plugin?


Lorenzo Orlando Caum

  • Support Staff

July 29, 2016 at 1:50 pm

Hello,

If you have an existing file there, then that can be used.

I still do recommend keep all customizations (e.g. messaging changes via gettext filters) in one spot rather than across different files.

If I were setting this up on my own site, then my first choice would be a child theme’s functions.php file and my second would be a site specific plugin to hold Event Espresso related customizations. That way if you need to change something in the future, then you can add it where you have existing customizations.

Does that help?


Lorenzo


Maccabee Levine

August 1, 2016 at 6:16 am

Lorenzo I was of the impression that keeping a custom_functions.php in /wp-content/uploads/espresso keeps the file safe during any upgrades. So with that said can you give me the location of your gettext filter so I can copy it over into my custom_functions.php file?


Tony

  • Support Staff

August 1, 2016 at 7:19 am

Let me try and clear some of the confusion around the custom_functions.php file.

When you declare a function within PHP, another function can not be declared with the same function name (a fatal error will be thrown if that happens). When EE declares its own functions a lot of them check if the function already exists and if so will not declare the function again, but use the existing one.

custom_functions.php is a file used within EE3 to allow you to always load your custom functions before EE loads. So basically it’s a method of overriding existing functions within EE because your custom functions load first and then EE checks for those custom functions.

The custom_functions.php file you hav in the current location is update safe. However, loading your own custom functions (like the gettext functions above) does NOT override an existing function, it hooks in and changes the output. This is different than what the custom_functions.php file is for so…

So with that said can you give me the location of your gettext filter so I can copy it over into my custom_functions.php file?

You don’t place that within custom_functions.php, you create a Custom Functions Plugin that you can place the function (and others) within.

So if you follow custom functions plugin tutorial linked above and add this function:

https://gist.github.com/Pebblo/998b051a5b8c357c4458715dfb8b0487

That will translate the string for you.

  • This reply was modified 8 years, 2 months ago by Tony. Reason: Typo


Maccabee Levine

August 1, 2016 at 8:00 am

Ok, that makes sense. I will give it a try.


Maccabee Levine

August 1, 2016 at 1:03 pm

I followed the tutorial and created a plugin in /wp-content/plugins called “Get File Plugin”. I add your code and edited the text that I wanted changed. When I update the page nothing happens. I am assuming I missed something.


<?php
/*
Plugin Name: Get File Plugin
Description: Site specific code for quantum.esu.edu/advancement to override gettext filter for EE and change "adding Attendee text".
*/
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */

//* Change messaging in Event Espresso
function tw_ee_custom_messaging( $translated, $original, $domain ) {
    $strings = array(
        //Add strings here in the format 'original string' => 'replacement string', for example:
        'Register Additional Attendees (Click Here)' => 'Register Additional Attendees',
    );
    if ( isset( $strings[$original] ) ) {
        $translations = get_translations_for_domain( $domain );
        $translated = $translations->translate( $strings[$original] );
    }
    return $translated;
}
add_filter( 'gettext', 'tw_ee_custom_messaging', 10, 3 );

/* Stop Adding Functions *
  • This reply was modified 8 years, 2 months ago by Tony. Reason: Code formatting


Tony

  • Support Staff

August 1, 2016 at 3:51 pm

'Register Additional Attendees (Click Here)' => 'Register Additional Attendees',

Is a different string from what you need to change.

This is the text your want to change right? – http://take.ms/s6ygd

The code used to output that text is:

'Add More Attendees? (click to toggle, limit %s)'

So you want to use:

'Add More Attendees? (click to toggle, limit %s)' => 'Register Additional Attendees',

I’ve updated my gist above to match this change so you can view how the code should look.


Maccabee Levine

August 2, 2016 at 5:54 am

Thanks Tony, that did it. First time making a plugin.


Tony

  • Support Staff

August 2, 2016 at 6:00 am

Nice job, welcome to the plugin club 🙂

I’m glad its now working for you.


Maccabee Levine

August 2, 2016 at 2:06 pm

Tony, can the email for the additional attendees be made required?


Tony

  • Support Staff

August 2, 2016 at 2:27 pm

To do that you would need to require the personal information question group for additional registrants, however you requested not to require that information in a previous thread here:

https://eventespresso.com/topic/simple-attendee-information-page/#post-211412

So yes it can be done, but it reverts changes your previous requested.

Viewing 14 reply threads

The support post ‘Event registration page – Add More Attendees’ 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