Support

Home Forums Event Espresso Premium Members only event : Change text Reply To: Members only event : Change text

Reply To: Members only event : Change text

Author Replies
Tony # Posted on 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?

Do NOT follow this link or you will be banned from the site!