Support

Home Forums Event Espresso Premium Attendee Number – can I reset it or hide it while registering

Attendee Number – can I reset it or hide it while registering

Posted: April 5, 2016 at 1:22 pm


Julie Hinton

April 5, 2016 at 1:22 pm

I have an event for a high school reunion. We are selling tickets for 2 different nights. We will have people sign up who are possibly bringing a spouse on either night. People are finding it confusing when signing up for the first night they are “Attendee 1 & 2” and on the second night are “Attendee 3 & 4”. Is there a way to make the attendee number reset for the second night signup (since they will be the same people), or simply prevent the number from showing on the page? I have looked through the forum and cannot find an answer. Thanks.


Tony

  • Support Staff

April 5, 2016 at 1:27 pm

Hi Julie,

You can’t easily reset the number, however you can change it not to show a number at all.

Would you prefer just ‘Attendee’ or another phrase?


Julie Hinton

April 5, 2016 at 1:53 pm

Okay, that works. How about just removing the number and leaving it “attendee”?


Tony

  • Support Staff

April 5, 2016 at 2:01 pm

Sure.

The easiest way to do that is by translating the string to remove the number. We have an example of a function you can use to do that here:

https://eventespresso.com/wiki/how-to-change-wording-with-poedit/#custom-function

The string to translate would be ‘Attendee %d’, the %d is a place holder for the number. So we can just translate the string to not use it, like this:

function mycustom_filter_gettext( $translated, $original, $domain ) {
 
    // This is an array of original strings
    // and what they should be replaced with
    $strings = array(
        'Attendee %d' => 'Attendee',
        // 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', 'mycustom_filter_gettext', 10, 3 );

You can add that function to you child themes functions.php file or create a Site Specific Plugin and place it within that.

Does that help?


Julie Hinton

April 5, 2016 at 2:23 pm

I tried this using a plugin for functions, but it says there is an error. I don’t know about the syntax for functions. Do I need to add something before and/or after this code?


Tony

  • Support Staff

April 5, 2016 at 2:26 pm

Can you copy all of the code from your plugin and paste it on either http://pastebin.com/ or create a gist here so I can view the code please?


Julie Hinton

April 5, 2016 at 2:36 pm

Sorry, this is too complicated for me. I’ll just keep it the way it was originally written.
Thanks.


Tony

  • Support Staff

April 5, 2016 at 2:42 pm

I’ve wrapped my example up into a plugin you can install if that helps?

You can download it here – http://take.ms/b8o1A

When you have the .zip file go to Dashboard -> Plugins -> Add New -> Upload plugin.

Select the .zip you downloaded from the above, upload and activate.

I’ve ran this through some quick testing on a live test site and found no problems.


Julie Hinton

April 5, 2016 at 3:18 pm

You are too kind. You all really go above and beyond to take care of people. Thank you so much. It works like a charm!


Tony

  • Support Staff

April 5, 2016 at 3:25 pm

You’re most welcome, Julie.

Any further problems just let us know 🙂

The support post ‘Attendee Number – can I reset it or hide it while registering’ 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