Posted: February 20, 2024 at 6:03 pm
Hi there, I’d like to change the text of the button here: 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 ); $text = ‘REGISTER’; return $text; } — Thanks for your help! |
|
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 |
|
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 |
|
SO CLOSE! I FOUND THE TEXT OF THE ERROR MSG: 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! |
|
Hi there, This: 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 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 Adding 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:
As the first line of your |
|
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?: I don’t see ‘event_espresso’ in the URL for this page: Thanks for your time, Linton |
|
No, you can’t replace entire class files like that. We allow it for template files (which will usually end
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.
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.
Its not that kind of domain, its the text_domain. When you pass strings to be translateable its done like this:
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:
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? |
|
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! |
|
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: 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 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: 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! |
|
…. 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.
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 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.
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. |
|
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.