How to change the elements for the form?

WordPress Event Management, Calendars & Registration Forums Frontend Submissions How to change the elements for the form?

This topic contains 8 replies, has 2 voices, and was last updated by  Olaf Lederer 2 months, 1 week ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #26817

    Hi,

    there is the the file “templates/elements/eo-event-form-event-tickets.php” and I would like to change that one. I tried to copy the file to my theme (created a directory named “elements” first), but the changes I do inside the file copy doesn’t show up.
    Is it possible that way? If not how to hide the “sales” part?

    Thanks

    Olaf Lederer
    #26829

    Hi Olaf,

    Normally it should go in the root of the theme. However the tickets element is not templatable; I’ll address this is the next non-patch update.

    In the meantime edit the template in the plugin and copy it to the root of your theme.

    Stephen Harris
    #26830

    In the meantime edit the template in the plugin and copy it to the root of your theme.

    So you say I don’t have to re-use the directory structure like inside the plugin’s template directory?

    Olaf Lederer
    #26831

    Exactly, it just checks the theme root.

    You can register additional locations if you wanted to organise your templates: https://wp-event-organiser.com/blog/tutorial/adding-alternative-locations-for-templates/ (you would just need to use the eventorganiser_template_stack part)

    Stephen Harris
    #26947

    Hi,

    I placed eo-event-form-event-tickets.php into my child theme directory, but the changes are not recognized.

    Maybe it need something else since this templates is part of an extension (FES)?

    Thanks

    Olaf Lederer
    #26958

    Hi Olaf,

    I think you missed my earlier comment: Normally it should go in the root of the theme. However the tickets element is not templatable; I’ll address this is the next non-patch update.

    So for now, just edit it in-place but keep a copy of it in the root of your theme.

    Stephen Harris
    #27006

    Hi Stephen, that should work.

    Actually I’m trying to hide the ticket section, while adding always one kind of ticket (free 999 tickets). We don’t sell them, we just need to know how many people like to join an event.
    This function requires a ticket (that makes sense), but in the front-end it’s not necessary that some has to add one.
    I tried to hide some stuff and added hidden fields instead, but I have the idea that you JS function adds some additional ID’s to the dynamic form elements. So while submitting the form I get an error. Is there a better way?
    Thanks

    Olaf Lederer
    #27017

    I would recommend using the hooks to add the ticket once the event is created. There’s no documentation for FES hooks’ at present, but the following should work:

    add_action( 'eventorganiser_fes_submitted_event', function( $event_id ) {
    
        $ticket = array(
           'name' => 'ticket name',
           'price' => 0,
           'spaces' => 999,   
        );
    
        //Only required if selling by date
        $occurrences = eo_get_the_occurrences( $event_id );
        $ticket['occurrence_ids'] = array_keys( $occurrences );
    
        eventorganiser_insert_ticket( $event_id, $ticket );
    } );
    

    The above runs whenever an event is submitted via the FES form.

    Stephen Harris
    #27022

    Thanks, that looks great :)

    So while using this action I can hide the button and the ticket is added all the time…

    Olaf Lederer
Viewing 9 posts - 1 through 9 (of 9 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.