Support

Home Forums Event Espresso Premium Members only event : Change text

Members only event : Change text

Posted: May 7, 2018 at 4:11 am

Viewing 17 reply threads


Oguzhan Altun

May 7, 2018 at 4:11 am

Hello,

I’ve installed the ultimate members plugin to launch our membership program. I managed to make it work with Event Espresso so far.

Now I’m trying to change the default “Free ticket is available to members only message” for both non logged in users and also logged in users who do not have a member status yet. I would like to show:

Click here to become a member

“Click here” linked to my become a member page.

I checked the following threads but not sure how to add a custom link to the message.

https://eventespresso.com/wiki/wp-user-integration/#custom_restricted_ticket_message
This redirects to the WP-user login, which is not what I need.

https://eventespresso.com/topic/wp-user-change-is-available-to-members-only/

Thanks


Oguzhan Altun

May 7, 2018 at 4:26 am

I would also like to hide the Address section for non-logged in and logged in but not a member users, if possible.


Tony

  • Support Staff

May 8, 2018 at 3:22 am

Hi there,

I checked the following threads but not sure how to add a custom link to the message.

https://eventespresso.com/wiki/wp-user-integration/#custom_restricted_ticket_message
This redirects to the WP-user login, which is not what I need.

That’s actually exactly what you need, the only difference being the URL.

Here’s another example:

https://gist.github.com/Pebblo/783dc4f9f43b9780d860112817edfd6d

You need to return the correct link yourself when using the functions above, how you pull the correct link is up to you. In my example you can change:

https://www.example.com/your-profile/login/

to whichever URL you want the user to go to, or if ultimate member has a function to return a specific registration page you can use that, it all depends on what you want to do.

For example you could just use something like this:

https://gist.github.com/Pebblo/783dc4f9f43b9780d860112817edfd6d#file-example2-php

Change the URL to whatever you want to use and that should be it.

I would also like to hide the Address section for non-logged in and logged in but not a member users, if possible.

We don’t currently have an option to hide specific question groups based on the user.


Oguzhan Altun

May 9, 2018 at 7:31 am

Hi Tony, super, that worked, thank you.


Oguzhan Altun

May 9, 2018 at 8:54 am

sorry, just one more question, I just realized this text also shows if I add a members only discounted ticket to a normal event.

How can I add the price of the ticket to this text?
Something like:

XX Ticket is reserved for members

where XX would be either “Free” or the discounted price.


Tony

  • Support Staff

May 9, 2018 at 9:07 am

where XX would be either “Free” or the discounted price.

It’s not really clear above if ‘XX’ would be the price, or the ticket name as that could be either.

So do you want to display the ticket name there or the price?


Oguzhan Altun

May 9, 2018 at 9:10 am

The price please. Would be good to know how to show the ticket name as well, just in case, but probably won’t need it.


Tony

  • Support Staff

May 9, 2018 at 9:23 am

It all already there in the gist 🙂

This one: https://gist.github.com/Pebblo/783dc4f9f43b9780d860112817edfd6d#file-example-php


 return sprintf(    
        'You must login as a member to view the %1$s%2$s%3$s%4$s option. Log-in "<a href="https://www.example.com/your-profile/login/">here</a>".',
        '<strong>',
        $ticket->name(),
        $ticket_price,
        '</strong>',
        $ticket_status
    );

sptrintf() takes a string with palceholders (thats what %1$s etc are) and replaces the place holders with the values passed. So %1$s is replaced by the first value, %2$s the second and so.

So for: XX Ticket is reserved for members

You change You must login as a member to view the %1$s%2$s%3$s%4$s option. Log-in "<a href="https://www.example.com/your-profile/login/">here</a>".

to

%3$s Ticket is reserved for members

%3$s because $ticket_price is passed as the 3rd parameter.

Make sense?


Oguzhan Altun

May 9, 2018 at 9:57 am

Yes, managed it!:) Any idea why this variable is pulling the price in this weird format?

(374 (CHF))

instead of just 374?


Tony

  • Support Staff

May 9, 2018 at 3:42 pm

Because that’s how the default message outputs the price – http://take.ms/ZpghV

You can change it for raw output by using $ticket->price()


Oguzhan Altun

May 10, 2018 at 2:54 am

Thanks Tony. How could I change it so that it shows on the 374(CHF) without the extra parentheses like here:
https://github.com/altuno/spc_wp/issues/1


Tony

  • Support Staff

May 10, 2018 at 3:52 am

You use EEH_Template::format_currency($ticket->price());

That will use the same formatting the ticket selector uses to display the price.


Oguzhan Altun

May 10, 2018 at 4:24 am

Sorry, I add this as a separate line or replace $ticket->price(), ?

I tried the latter and I got an error


Tony

  • Support Staff

May 10, 2018 at 4:59 am

Can you post the code you used to a gist/pastbin so I can view it?


Oguzhan Altun

May 10, 2018 at 2:36 pm

Sure, here you go:
https://gist.github.com/altuno/f07f881194cb6083bb1c0f72f3abf746


Tony

  • Support Staff

May 10, 2018 at 2:37 pm

Line 6 you should change from:

$ticket->price(),

to

EEH_Template::format_currency($ticket->price()),

That should then work.


Oguzhan Altun

May 10, 2018 at 2:47 pm

I just did, strangely it still shows only the number:

https://dev2.genevaphotoclub.com/events/weekday-intermediate-evening-5x2hrs-may-28-jul-2/


Tony

  • Support Staff

May 15, 2018 at 2:15 am

That’s odd.

You should only have one function changing that text, can you double check there’s not another function using the previous code?

I just tested the code you are using with my change: http://take.ms/jisVY

Viewing 17 reply threads

The support post ‘Members only event : Change text’ 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