Support

Home Forums Event Espresso Premium Adding a URL to a custom translation

Adding a URL to a custom translation

Posted: January 15, 2022 at 9:24 am


Omar Paloma

January 15, 2022 at 9:24 am

I would like to use the method here (https://gist.github.com/Pebblo/e0b88c12988f1d12c16692e4d4554bf0) to enter an actual. My users regularly forget their password and the default only takes them to create a new membership not find a password. Of course I know they can easily do it from that page but people being people, I get lots of email that they “cannot figure it out”. If I can add the reset password url it would save some calls.

The problem is, I cannot figure out the syntax. No matter what I do, I get a parsing error.

Can you help?
'<a href="//wwww.website.co.uk/login '">'here '</a>'


Tony

  • Support Staff

January 17, 2022 at 3:40 am

Hi there,

Your example contains multiple single quotes which if you are including in the above function would give you a parse error because the function opens and closes the string using them.

So something like this should work:

'Custom The event you have selected requires logging in before you can register. You can %sregister for an account here%s if you don\'t have a login. Reset your password <a href="//wwww.website.co.uk/login">here</a>'

If you need to include single quotes in the string then you’ll need to escape them using \ (like has been done above with don\'t).


Omar Paloma

January 17, 2022 at 3:42 am

Ugh… Yes. I knew it was the quotes but I thought it was the double quotes. Thanks!


Omar Paloma

January 17, 2022 at 3:46 am

This reply has been marked as private.


Tony

  • Support Staff

January 17, 2022 at 3:54 am

Just to give a better example here, when you define a string you can either do:

$string = 'This is a string with no quotes inside it';

or

$string = "This is a string with no quotes inside it";

The difference between the 2 is when you use " PHP will parse variables passed to it, so another example:

$some_var = 'Hello ,';

$string1 = '$some_var this is a string with no quotes inside it';
\\Output - $some_var this is a string with no quotes inside it

$string2 = "$some_var this is a string with no quotes inside it";
\\Output - 'Hello , this is a string with no quotes inside it

PHP needs to know where the string starts and ends, so when you open with either one of those it will ‘end’ the string on the next instance:

$parse_error = 'This is a string with quotes inside it, it won't work as PHP doesn't know which ' is the end';

This works:

$parse_error = 'This is a string with quotes inside it, it won\'t work as PHP doesn\'t know which \' is the end';
\\Output - This is a string with quotes inside it, it won't work as PHP doesn't know which ' is the end

And… finally, you can mix and match:

$this_also_works = 'This "string", will work fine';
\\Output - This "string", will work fine

So it’s a case of matching your opening quotes with your closing, escaping any that should be included in the string and choosing either single or double quotes depending on the use case.


Tony

  • Support Staff

January 17, 2022 at 4:23 am

(Posted the above whilst you posted your last reply)

Thanks for your suggestion on creating a course for these types of customizations for people to learn with.

However, I disagree with the assessment of our support load decreasing with those kinds of courses. A ‘PHP for beginners’ type course focuses on learning PHP itself, you take that course because you want to learn some PHP, right? You can then apply those skills to customizations like this… because you know PHP.

A ‘PHP for beginners so that you can customize some section of EE’ is basically exactly the same (there’s nothing special about EE’s PHP) but now the premise is to learn EE customizations, not PHP (yes you’d learn PHP but that wouldn’t be the real goal for most taking it). With that type of course the focus is not learning PHP to apply those skills to EE, but to customize EE. That may not seem like much but it means the assumption by the person taking the course (no matter how much we would try and market it otherwise) would be our support for customizations.

I suspect we would either end up with more posts here on the forums requesting help with customizations and officially we don’t provide support for any customizations. If I can help point someone in the right direction I will, but that’s still not official EE support. Or, supporting those people wanting to customize a specific section of EE whilst taking the course who don’t understand it because they know very little PHP will start taking time away from here (the ‘official’ EE support channel).

So… In my opinion, if someone wants to learn enough to start customizing Event Espresso:

1. Start with a PHP for beginners course (there a dime a dozen, so find one that suits your own learning style and roll with it, you don’t need to be a PHP blackbelt to customize EE).
2. Get comfortable with a Text Editor, Sublime Text is great for stuff like this (advanced users will likely be using an IDE like PHPStorm)
3. Learn how WordPress hooks work (EE has literally thousands of hooks you can use to customize various sections and that’s not including the WordPress core hooks which also affect EE functionality)
4. Optional – Get comfortable with Git and Github, it’s not strictly a requirement but will help. You can then also start adding your own hooks into EE if needed and opening a pull request to have them included in our codebase.

All of those skills can then be applied to almost ANY plugin within WordPress, with the above you didn’t learn how to use an EE specific hook/function to change what you wanted… you learnt how to find that EE specific hook/function and how to correctly make changes with your new skills, that’s a much more useful skill to have.


Omar Paloma

January 19, 2022 at 2:52 am

Thanks, Tony. Your perspective is well understood and hinted at in my question. Your detailed explanation fully explains why it is not smart for EE to do.

Php for Beginners – Refresher Course, anyone?


Tony

  • Support Staff

January 19, 2022 at 5:05 am

Yeah, sorry.

I know you mentioned that above and should have added that to my reply, I just wanted to add some more details on why (at least right now) I personally don’t think it is something we (EventEspresso) could/should take on.

It’s a good idea for someone to market specifically to customizing EE as their own niche though 🙂

The support post ‘Adding a URL to a custom translation’ 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