Support

Home Forums Event Espresso Premium Change login error message

Change login error message

Posted: September 11, 2020 at 5:29 pm

Viewing 4 reply threads


Tony

  • Support Staff

September 14, 2020 at 5:03 am

Hi there,

What is the full string you added to the page?

You need to translate this string:

%1$sYou have entered an email address that matches an existing user account in our system.%2$sYou can only join the Wait List using your own account or one that does not already exist.%2$sPlease use a different email address.%3$s

https://translate.eventespresso.com/projects/event-espresso-4/en/event-espresso-en_us/?filters%5Boriginal_id%5D=24588

The place holders ($X$s) are important as they are used for HTML tags.


Somatic Practice

September 14, 2020 at 6:52 pm

Thanks, I added those, but it’s still not working. Here’s my code:

function signuperror_filter_gettext( $translated, $original, $domain ) {
 
    // This is an array of original strings
    // and what they should be replaced with
    $strings = array(
      	'%1$sYou have entered an email address that matches an existing user account in our system.%2$sYou can only join the Wait List using your own account or one that does not already exist.%2$sPlease use a different email address.%3$s' => 'Test'
        // 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', 'signuperror_filter_gettext', 10, 3 );

Please let me know if I’ve made an error.


Tony

  • Support Staff

September 15, 2020 at 9:34 am

Hi there,

Which specific message are you viewing? Is it in a notice or on the page itself?

There’s actually 2 locations for that string, one if the full string mentioned above and the other is without placeholders.

Try:

$strings = array(
    '%1$sYou have entered an email address that matches an existing user account in our system.%2$sYou can only join the Wait List using your own account or one that does not already exist.%2$sPlease use a different email address.%3$s' => 'Test',
    'You have entered an email address that matches an existing user account in our system.  If this is your email address, please log in before continuing your registration. Otherwise, register with a different email address.' => 'Test 2'
    // Add some more strings here
);

In the function above, does you see either ‘Test’ or ‘Test 2’ at all?

Also, where have you added the code? functions.php may be too late in the request so we recommend creating a custom functions plugin to hold functions like these:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/


Somatic Practice

September 15, 2020 at 1:44 pm

Thanks, I was able to get this resolved after reviewing your code.

Viewing 4 reply threads

The support post ‘Change login error message’ 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