WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
Can Ticket Info be extended? (8 posts)

  1. maymard
    Member
    Posted 2 years ago #

    I would like to add some fields to the ticket, such as specific types. Is there a tutorial that shows how to extend the EM_Ticket class and the booking/registration popup to include the new fields? I didn't see anything on the site or forum.
    Thanks!
    Mike

    http://wordpress.org/extend/plugins/events-manager/

  2. maymard
    Member
    Posted 2 years ago #

    OK, no one responded, so I was able to add a field and will share how I did it so if there's a better way, it can be pointed out:
    1. I added a new em_tickets_ext extension table with the event_id, ext_id, etc.
    2. Added my new extension class modeled from em-ticket.php and added logic to select, update and delete from my new table
    3. added add_action('em_ticket_save','my_em_styles_ticket_save',1,2); to save to my new table.
    4. added add_action('em_ticket','my_em_styles_ticket_load',1,2); which does a select on my new table to get my fields and add them to the $EM_Tickt object
    5. Added a new input element for my new field to tickets-form.php

  3. agelonwl
    Member
    Posted 2 years ago #

    Does it work without any conflicts to other class? also be sure that you put it in other file so that it will not be overwritten during version update.

  4. maymard
    Member
    Posted 2 years ago #

    Although I haven't done extensive testing, all other functionality appears to be working fine. Thanks for your recommendation. I noticed that bookings have a booking_meta column that can be used to store custom information. That would be a great addition to the ticket as well, so I wouldn't need to add my own table.

  5. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    I advise you check out http://wp-events-plugin.com/tutorials/ to learn how to use the em_meta table instead

  6. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    I advise you check out http://wp-events-plugin.com/tutorials/ to learn how to use the em_meta table instead

  7. maymard
    Member
    Posted 2 years ago #

    Thanks Marcus. Makes sense. I'm assuming em_ticket and em_ticket_save are the correct hooks to use for loading and saving data to em_meta at the ticket level.

  8. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    yes, exactly (and em_ticket_get_post/em_ticket_validate too to retrieve the post data before saving, although i guess you could do it during save if you don't want to validate it).

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic