Support

Home Forums Event Espresso Premium WP User – change "is available to members only."

WP User – change "is available to members only."

Posted: November 14, 2015 at 4:29 pm

Viewing 3 reply threads


Freddys

November 14, 2015 at 4:29 pm

Hi,
We are using the WP user add-on to qualify the attendees for different tickets..

I wanted to know if anybody can give me guidance on changing the message it says on the ticket selector. It seems that by default it says: “XYZ (for $$) is available to members only.”

We would like to change the “is available to members only.” to something that makes more sense to our users, so something like “is only available to registered scholars.”

Any guidance on how to get this done would be greatly appreciated!
– Freddys


Tony

  • Support Staff

November 16, 2015 at 2:42 am

Hi Freddys,

One way to edit that string is to translate it using a custom function. You can find an example here:

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

I’ve put together the function for you here:

//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function mycustom_filter_gettext( $translated, $original, $domain ) {
 
    // This is an array of original strings
    // and what they should be replaced with
    $strings = array(
        'The %1$s%2$s%3$s%4$s  is available to members only. %5$s' => 'The %1$s%2$s%3$s%4$s  is only available to registered scholars. %5$s',
        // 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 );

Which will change the text to look like this – http://take.ms/kzGjE

You can place that function within your themes functions.php file although I recommend creating a Site Specific Plugin and adding this to that.


Freddys

November 22, 2015 at 6:55 pm

This worked perfectly. Thank you so much for your response. Great support!


Tony

  • Support Staff

November 23, 2015 at 4:18 am

You’re most welcome 🙂

Viewing 3 reply threads

The support post ‘WP User – change "is available to members only."’ 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