Changing the wording of Event Tickets 4.2.1 notices?

Home Forums Calendar Products Events Calendar PRO Changing the wording of Event Tickets 4.2.1 notices?

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #1133190
    James
    Participant

    Hi,

    Sorry to “harp” on this, I had a simular problem a few updates ago which were fixed with the help of Geoff B. Old Post Here

    With Event Tickets, there are a series of three notices that are shown after certain triggers. eg. “Tickets are not yet available.”, “Tickets are no longer available.”, “There are no tickets available at this time.”. These are found in the file wp-content > plugins > event tickets > scr > Tribe > tickets.php
    and also there are entries in the translation .po files.

    If I change the wording in the translation files and upload to the languages folder, all other translation strings change but these notices don’t change. The only way I found to make the changes to the wording for these notices is to change the wording within the original file, tickets.php in the event tickets folder.

    Is this the only way to affect these changes to the notices or is there another way?

    Any assistance would be appreciated.

    Cheers
    James

    #1133451
    Cliff
    Member

    Hi James.

    Thanks for the details.

    The best way to edit this text may be to follow Change the wording of any bit of text or string (using the code snippet all the way at the bottom) or How to Override Plugin Language Files.

    Please let me know how things go for you.

    #1133719
    James
    Participant

    Hi Cliff,

    I don’t want to sound ungrateful for your assistance but the point of my post was that I have tried all these methods that you suggested with no results.

    Geoff B through the older thread (link in first post above) got me to the point where prior to this latest release, we had all the Translations and text wording working perfectly but now they are not as described above, since the last update.

    An observation I would like to point out, is that if the strings in question are in the translation files, shouldn’t they been reflected on the front end if modified? Which is not happening in this case. I can see that the translation files in the most part are being reflected on the front end, just not these notices in question.

    Cheers

    James

    #1133726
    Cliff
    Member

    I understand, James.

    I checked those 3 strings (Lines 1267-1286 in /wp-content/plugins/event-tickets/src/Tribe/Tickets.php) and they all have the proper text domains.

    Therefore, I’m wondering if your customization was affected by a translations bug that was recently patched via the latest version (4.2.1.1) of Event Tickets.

    Please update to v4.2.1.1 and let me know if all your problems are magically solved 🙂

    #1133771
    James
    Participant

    Hi again Cliff,

    Yes I am running the latest versions of the EC’s plugins including Event Tickets 4.2.1.1 hence why I’m at a loss as to why these notices aren’t working as I want them to, unless I change the core file.

    I’ve loaded a fresh copy of wordpress, the event calendar, event tickets and nothing else onto a testing localhost site and it still doesn’t change.

    Cheers

    James

    #1133883
    Cliff
    Member

    Bummer. Sorry, man.

    Could you please provide me the code you’ve added and specify where you’ve added it?

    #1134227
    James
    Participant

    Hi Cliff,

    I’m not sure what “code” you’re asking for.
    BUT, here is something I noticed! If I use the code below in my functions.php file, it override all the changes made in the translation files.

    Cheers

    James

    /*
    * EXAMPLE OF CHANGING ANY TEXT (STRING) IN THE EVENTS CALENDAR
    * See the codex to learn more about WP text domains:
    * http://codex.wordpress.org/Translating_WordPress#Localization_Technology
    * Example Tribe domains: ‘tribe-events-calendar’, ‘tribe-events-calendar-pro’…
    */
    function tribe_custom_theme_text ( $translations, $text, $domain ) {

    // Put your custom text here in a key => value pair
    // Example: ‘Text you want to change’ => ‘This is what it will be changed to’
    // The text you want to change is the key, and it is case-sensitive
    // The text you want to change it to is the value
    // You can freely add or remove key => values, but make sure to separate them with a comma
    // This example changes the label “Venue” to “Location”, and “Related Events” to “Similar Events”
    $custom_text = array(
    ‘Tickets are not yet available.’ => ‘Bookings are not yet available for this activity.’,
    ‘Tickets are no longer available.’ => ‘Bookings for this activity are no longer available.’,
    ‘There are no tickets available at this time.’ => ‘There are no bookings available at this time.’,
    );

    // If this text domain starts with “tribe-“, “the-events-“, or “event-” and we have replacement text
    if( (strpos($domain, ‘tribe-‘) === 0 || strpos($domain, ‘the-events-‘) === 0 || strpos($domain, ‘event-‘) === 0) && array_key_exists($text, $custom_text) ) {
    $text = $custom_text[$text];
    }

    return $text;
    }
    add_filter(‘gettext’, ‘tribe_custom_theme_text’, 20, 3);

    #1134241
    Cliff
    Member

    That looks like the code from the bottom of the Change the wording of any bit of text or string article.

    If I use the code below in my functions.php file, it override all the changes made in the translation files

    Am I right in understanding that your issue is now resolved then?

     

    #1134256
    James
    Participant

    Hi Cliff,

    No it isn’t resolved. I still can’t get the “notices” in the tickets.php file to change via the translation file. e.g event-tickets-en-AU.po

    The only way I can change the “notices” is via changing the wording within the core file. e.g /wp-content/plugins/event-tickets/src/Tribe/Tickets.php Lines 1267-1286

    What I was saying in my last post was that you recommended to try the code at Change the wording of any bit of text or string, which I did. But when I do, it overrides all my other translations in the event-tickets-en-AU.po file.

    So, I am back to where I was with the original question, of how can I change the “notices” in /wp-content/plugins/event-tickets/src/Tribe/Tickets.php Lines 1267-1286 so that I don’t overwrite them with a plugin update.

    Cheers

    James

    #1135132
    Cliff
    Member

    James, we tested and everything seems to be working fine so I’m wondering if maybe you’re not doing something correctly. Here are some ideas:

    If you’re editing .po, are you then compiling it back to .mo format?

    Since Event Tickets is distributed via WordPress.org, it may be the case that a translation file in the wp-content/languages/plugins directory is taking precedence. You should check this and either make your changes there or else consider deleting or temporarily renaming the corresponding .mo file you find there.

    I hope one of these tips helps. Please let me know.

    #1135332
    James
    Participant

    This reply is private.

    #1135353
    James
    Participant

    Hi Cliff,

    An update on the situation.

    I had a chance to download a fresh copy of event tickets and took the .pot file from the lang folder and reran it through Poedit, changing the translations and saving as event-tickets-en_AU.po and event-tickets-en_AU.mo files and uploaded them to the languages/plugins folder, then replaced the tickets.php file for the original one.

    Everything is now working as it should!

    So you can close this thread as things are solved, it seems there was an error in my .po file that was causing the problem.

    Thanks for your assistance to date.

    Cheers

    James

    #1135667
    Cliff
    Member

    Excellent. Great work resolving the issue! Thanks for letting me know.

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Changing the wording of Event Tickets 4.2.1 notices?’ is closed to new replies.