5K EVENT – TICKET NUMBER PREFIX AND NUMBER

Home Forums Ticket Products Event Tickets Plus 5K EVENT – TICKET NUMBER PREFIX AND NUMBER

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1276548
    Alfonso
    Participant

    I am working on a 5k event.

    During testing, I noticed that the tickets are generated with a prefix and a “-” and then the ticket number.
    Example: VCPTV5-7, VCPTV5-8, VCPTV5-9…and so on.

    As part of the 5k Planning, I would like to assign runners a number upon purchasing their ticket.

    Question:
    1. Can I control the Prefix so that instead of displaying “VCPTV5” I can make it “RUNNER”
    2. Can I set the initial number something arbitrary, let’s say RUNNER-100 so that the next tickets are 101, 102, and so on?

    If you have the function snippet to make this work, please forward.

    #1276844
    Cliff
    Member

    Hi, Alfonso.

    I’ll answer these in backwards order:

    2)

    We just recently added a hook making it possible to override the initial ticket number so it doesn’t have to start at 1.

    Please reference this code snippet:

    https://gist.github.com/cliffordp/91223c67e30e648257e47e50349d81f4

    It is required to be a positive integer.

    The applicable code is viewable at /wp-content/plugins/event-tickets-plus/src/Tribe/Meta/Unique_ID.php

    1)

    The part of that code that gets (or generates if not yet set) the prefix is the get_event_root() method in that file. The actual generation (if does not yet exist) happens in /wp-content/plugins/the-events-calendar/common/src/Tribe/Utils/Post_Root_Pool.php

    Long story short, it needs to be unique and therefore it’s generated accordingly instead of being something like “RUNNER”… because then your next event you could not use “RUNNER” again.

    Please let me know if you have any follow-up questions on this topic.

    #1277050
    Alfonso
    Participant

    Thank you!
    You state for 1)
    /wp-content/plugins/the-events-calendar/common/src/Tribe/Utils/Post_Root_Pool.php

    are you sure it is /the-events-calendar/

    I don’t have that plugin installed. I found the same file in the /event-tickets/ folder.

    I have /event-tickets/ and /event-tickets-plus/ directories.

    Please confirm.

    #1277520
    Cliff
    Member

    Ah, yes, in that case, the file would be at /wp-content/plugins/event-tickets/common/src/Tribe/Utils/Post_Root_Pool.php

    The “common” directory is code that is loaded whether you have The Events Calendar, Event Tickets, or both — to try to keep things DRY.

    Of course, it’s not recommended to modify core plugin files so the location of this file is likely moot if following best practices.

    I did log an internal feature request to allow customizing it to something like “RUNNER” with the idea that if “RUNNER” already exists, it’d instead generate something like “RUNNER1” instead.

    Please let me know if you have any follow-up questions on this topic.

    #1288367
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘5K EVENT – TICKET NUMBER PREFIX AND NUMBER’ is closed to new replies.