Support

Home Forums Event Espresso Premium Filter name to change text in REGISTER button on the Personal Information page?

Filter name to change text in REGISTER button on the Personal Information page?

Posted: February 20, 2024 at 6:03 pm

Viewing 9 reply threads


Somatic Practice

February 20, 2024 at 6:03 pm

Hi there,

I’d like to change the text of the button here:
https://app.screencast.com/6ji7x5hcQSXmV

We have successfully changed the text of a similar button on another page using the code snippet below. Can you tell me the name of the filter to use to change the text of the button in the screenshot above?

In case helpful, here’s the snippet that changes the text of the button on the event registration page that shows DETAILS, PRICE, and QTY:

add_filter( ‘FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text’, ‘ee_mer_change_cart_button’, 11 );
function ee_mer_change_cart_button( $text ) {

$text = ‘REGISTER’;

return $text;

}

Thanks for your help!


Rio

  • Support Staff

February 20, 2024 at 9:03 pm

I looked on it, and i don’t see any filter to do that. Will bring this to our tEEm for discussion and recommendation.

We don’t have a full list of all of the actions available within EE, however they are all prefixed with either AHEE__ (Action Hook Event Espresso) or FHEE__ (Filter Hook Event Espresso) so if you search for either of those strings in a text editor/IDE you’ll find all of our hooks.

Thanks


Somatic Practice

February 21, 2024 at 10:27 am

Hi Rio,

Love your pseudonym “tEEm”! Thanks again for your quick and useful response. I’ll search your code a little for FHEE__ and __btn_test and see if I get lucky!

If one of your developers can provide the name of this specific filter that would be wonderful.

Thanks again,

Linton


Somatic Practice

February 21, 2024 at 11:53 am

SO CLOSE! I FOUND THE TEXT OF THE ERROR MSG:
“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.”
THAT SHOWS WHEN THE ERROR OCCURS RIGHT ABOVE THE “REGISTER” BUTTON WE WANT TO CHANGE, BUT THE BUTTON CODE IS NOT IN THIS FILE:
public_html/somaticpractice.webwatchdawg.com/wp-content/plugins/eea-wp-user-integration/EED_WP_Users_Ticket_Selector.module.php

I’m hoping you will be able to follow up with someone who knows the details of this code to help me identify the filter that allows me to change the text on this button.

Thanks for your help!


Tony

  • Support Staff

February 21, 2024 at 1:35 pm

Hi there,

This: EED_WP_Users_Ticket_Selector.module.php

Is the wrong file, but close 🙂 That’s for showing a notice on the ticket selector when a waitlist form is available but login is required.

Your screenshot is from the Attendee information of the Single Page CheckOut, the code that adds that is in EED_WP_Users_SPCO.module.php

Within the loginAndRegisterButtonsHtml method: https://monosnap.com/file/HtM771iaFnRqAUftVjGYx72LI099zF

You can see there is no filter for that specific string in EE however, any strings that are translatable (and we try to make sure EVent Espresso is 100% translatable) is passed through the gettext filter, which I know from your other thread your already using.

Adding 'Register' => 'Create account', to your strings array will change that string to ‘Create account’ so change to whatever you prefer to use there.

Something important to note here!

gettext is a filter applied within WordPress core to ALL strings used on the site, which means by using it to translate ‘Register’ to something else, you are changing ALL instances of that string across the site.

One wa to prevent that is to use:

if ( 'event_espresso' !== $domain ) {
    return $translated;
}

As the first line of your signuperror_filter_gettext function… so it now only applies to strings with the event_espresso text domain (so only strings from us) and otherwise just returns the string as is.


Somatic Practice

February 21, 2024 at 3:45 pm

Thanks for this excellent explanation!

So, it would be possible to replace the file EED_WP_Users_SPCO.module.php by copying the file into the Avada child theme and simply changing the word ‘Register’ in that copy of the file, but that’s not recommended because we could run into a backwards compatibility problem if/when you update this file in the future. Is that right?

To be sure I understand, using the method you’ve described, the word ‘Register’ would be translated to ‘Create account’ everywhere in Event Espresso. There’s no way to limit the scope to a particular page, or a particular <div>, in this case the <div> with id=”ee_reg_qstn-5959-email-input-dv”.

Along these lines, can you help me understand what this bit of code means?:
‘event_espresso’ !== $domain

I don’t see ‘event_espresso’ in the URL for this page:
https://somaticpractice.webwatchdawg.com/registration-checkout/

Thanks for your time,

Linton


Tony

  • Support Staff

February 21, 2024 at 4:22 pm

So, it would be possible to replace the file EED_WP_Users_SPCO.module.php by copying the file into the Avada child theme….

No, you can’t replace entire class files like that. We allow it for template files (which will usually end .template.php) but not others.

To be sure I understand, using the method you’ve described, the word ‘Register’ would be translated to ‘Create account’ everywhere in Event Espresso.

Yes, but to be clear its only the specific string that you target, in this case ‘Register’, for ‘Register Now’ wouldn’t change to be ‘Create account Now’ with this example. Its only an exact ‘Register’ match that will change.

There’s no way to limit the scope to a particular page, or a particular

, in this case the

with id=”ee_reg_qstn-5959-email-input-dv”.

Not as it stands, I can request a filter is added to allow targeting the strings a little better but there isn’t another available right now.

Along these lines, can you help me understand what this bit of code means?:
‘event_espresso’ !== $domain

I don’t see ‘event_espresso’ in the URL for this page:

Its not that kind of domain, its the text_domain.

When you pass strings to be translateable its done like this:

esc_html__('Register', 'event_espresso')

esc_html__() is a function that translates the string (that’s the __() part) and then escapes it for safe HTML output.

‘Register’ is the string to be translated.

‘event_espresso’ is the ‘text_domain’ for the string…. so all strings in Event Espresso use the event_espresso text domain. The idea is that everyone uses their own text domain so the strings can be identified for a specific domain. A plugin called ‘My Super Plugin’ may use ‘my_super_plugin’ as the text domain:

esc_html__('Register', 'my_super_plugin')

gettext on its own filters both of those and would change both to be ‘Create account’, but because the text domain is passed to the filter with each string, we can use it to check specifically for the ‘right’ string to translate (the one(s) with a text_domain of ‘espresso_events’).

Make sense?


Somatic Practice

February 22, 2024 at 11:00 am

Thank you Tony, your’e awesome. Yes, it makes sense. I really appreciate your taking the time to expain this to me. Have a good one!


Somatic Practice

February 22, 2024 at 11:22 am

Another couple of thoughts:

Sure, yes, please do request that a filter is added to allow targeting the test of this button, the Register button in EED_WP_Users_SPCO.module.php, like this one for the button on the previous page:
FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text

That would be ever so cool. BUT, there may be a better approach…

The reason we want to change this button text is because the previous developr set it up to use this REGISTER button to point to a custom login page at
https://somaticpractice.webwatchdawg.com/cart-login/
using WP User Integration’s Default setting
“Registration Page URL (if different from default WordPress Registration)”
here:
https://somaticpractice.webwatchdawg.com/wp-admin/admin.php?page=espresso_registration_form&action=wp_user_settings

He used that field on the WP User Integration Defaults settings page, and hid the LOGIN button using CSS. It looks like he did that because he wasn’t able to point the LOGIN button to the custom login page, and we has able to change the link on the REGISTER page.

So, with y’all’s help I commented out the CSS to unhide the button, but the button’s not working:
https://app.screencast.com/st5Q6T8FVfIRL
It redirects back to the same page we’re already on. 🙁

So another approach would be to simply make the LOGIN button work… How might it be possible to link this button to our custom login page?

Thanks again!


Tony

  • Support Staff

February 22, 2024 at 2:44 pm

He used that field on the WP User Integration Defaults settings page, and hid the LOGIN button using CSS. It looks like he did that because he wasn’t able to point the LOGIN button to the custom login page, and we has able to change the link on the REGISTER page.

…. sigh.

That login form uses wp_login_url() to generate the URL for the login.

Hit that link and check the last line of the code for that function.

apply_filters( 'login_url', $login_url, $redirect, $force_reauth );

Just add your own function to hook into the that filter and set the URL to whatever you want to it be, don’t forget to add the value of $redirect as a query_arg and the same if reauth is true.

In short, you don’t need a filter within EE to change that URL, its using the abov function to allow functions/plugins to hook in and change the login URL. If you were using a plugin to point your site to a custom login page, 99% of the time it would already be using that exact filter to do it.

It redirects back to the same page we’re already on. 🙁

Worst part is, if that is happening then it sounds like something may already be hooking into the above to set the URL to nothing, in which case it could of just been set correctly.

Viewing 9 reply threads

The support post ‘Filter name to change text in REGISTER button on the Personal Information page?’ 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