Customizing the admin-views/meta-box.php file

Home Forums Ticket Products Event Tickets Plus Customizing the admin-views/meta-box.php file

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1194825
    Paul
    Participant

    Hello 🙂

    In this thread:

    Remove RSVP?


    I asked if it was possible to remove the RSVP option, as we only sell our tickets using Woo.

    Rather than remove the RSVP option all together, I have simply made WooCommerce the default selected radio button (it’s normally RSVP) by editing the file Geoff pointed me to:
    /wp-content/plugins/event-tickets/src/admin-views/meta-box.php

    All I have done is change true to false on line 131 and false to true on line 139. This works great but as Geoff pointed out, it gets overwritten when I update.

    I have previously managed to do some customisations which do not get overwritten when I update by following your tutorial here:
    https://theeventscalendar.com/knowledgebase/themers-guide/
    I simply place my customised files into:
    /wp-content/themes/my-child-theme/tribe-events
    and my customizations persist after updates. 🙂

    I cannot figure out how to do it with the meta-box.php file. Is there a particular folder hierarchy I should be using to put my modified meta-box.php file into?

    As always, many thanks for your help.

    Paul.

    #1195442
    Nico
    Member

    Hi Paul,

    Thanks for getting in touch with us! I’ll help you here…

    Unfortunately the template override method is not available for admin views (although we are exploring this possibility). So the options here are:

    1) Re-do your customization after every update.

    2) Explore alternatives (probably JS snippet) to do the same thing from outside the core files. I can help you getting started with this one.

    Please let me know about it and I’ll help as possible,
    Best,
    Nico

    #1195650
    Paul
    Participant

    Hi Nico,

    Thanks for your reply.

    I’ve never really explored JS so I would need some help getting started with that.

    If you could point me in the right direction I would be very grateful.

    Paul.

    #1196941
    Nico
    Member

    Hey Paul,

    Don’t worry about it! I just coded a basic sample for you 😉

    Just paste the code below in your theme’s (or child theme’s) functions.php file:

    /* Tribe, remove RSVP tickets option from event page in the admin */
    function tribe_remove_rsvp() {

    // check if it's a Tribe admin page
    $screen = get_current_screen();

    if( !isset($screen->ID) || $screen->ID != Tribe__Events__Main::POSTTYPE ) return;

    // switch default provider and hide RSVP
    ?>

    <script type="text/javascript">

    jQuery(document).ready(function($){

    if ( $('input.ticket_field[value="Tribe__Tickets_Plus__Commerce__WooCommerce__Main"]').length ) {

    $('input.ticket_field[value="Tribe__Tickets_Plus__Commerce__WooCommerce__Main"]').click();
    $('input.ticket_field[value="Tribe__Tickets__RSVP"]').hide().next().hide();
    }

    });

    </script>

    <?php }

    add_action('admin_head', 'tribe_remove_rsvp');

    Give it a try and let me know if it works for you,
    Best,
    Nico

    #1207077
    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 ‘Customizing the admin-views/meta-box.php file’ is closed to new replies.