Break Recurring Event

Home Forums Ticket Products Event Tickets Plus Break Recurring Event

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1182257
    Jon
    Participant

    Hi,

    I understand that recurring events and tickets are currently not supported yet. But I wanted to find out if there was a way to break the series completely possibly in one function. Like press a button and it would covert the series into individual events. I am not sure if this would be harder to do versus the development issues you may be facing trying to get the recurring issues resolved. But if that were possible then everything would be awesome. My client loves this plugin. But I did not realize that there were a lot of issues with the recurring events function. It has hit the issues below:

    • Tickets stock is used across entire series versus individual event (I understand this is the main issue).
    • Receipts are not showing the correct dates for the event purchased through the recurring event. Instead it only shows the date for the first event no matter what date is picked.
    • Autocomplete order doesn’t seem to be working.

    While again I state I understand that this is not supported. I am just trying to break the series while allowing the tickets to be duplicated while the series is broken. It would make it so much more easier than creating the series, breaking it, then having to re-add a million tickets. My php coding is not on par as your awesome development team. So I am asking you the experts for hopefully a work around.

    http://www.trachmasters.com is the website.

    Warm regards,

    Jon

    #1182854
    Andras
    Keymaster

    Hello Jon,

    Thanks for going Pro and welcome to the forums! That’s a super interesting question! It got me curious as well, so I check around a bit, because out of the box we don’t have that kind of functionality.

    And we don’t have a snippet either that would do it for you. Here is what I found out:

    In order to break up a recurring event series into single events, you need to do the following in the database:

    • Find out the post_id (event_id) for all the recurrences, including the starting instance.
    • In the wp_postmeta table delete the rows where the “meta_key = _EventRecurrence” for all the above post_ids
    • In the wp_posts table change the post_parent to zero (0) for all the recurrences (based on the post_id)

    This should break up the whole recurring event to single instances. Note, I only did a quick-and-rough test on this, so if you want to test it, I recommend either a backup or rather a test site.

    Also, I believe that this will not create separate tickets for all the events. That cannot be done as the ticket created is linked to the starting event. You would need to either manually copy the tickets assigning them to the post_ids or manually create them for each event.

    Even though I don’t have a solution for you, I do hope this helps.

    Let me know if you have any other questions regarding this topic.

    Cheers,
    Andras

    #1186005
    Jon
    Participant

    So I took what you provided and it helped out get my client to a halfway mark. While it doesn’t solve the ticket issue itself. I can at least generate a group of events and then convert them now into single events. Instead of the mundane task of copying and pasting everything. I have provided my solution below. It takes a few steps.

    Step One – Prepping your website to break the event series. I took the information and created a query that is executed to break the series based on a LIKE value for all event recurrences. These are two separate queries. One deletes the recurring instance for any and all events in the post meta table. And the second one updates the post_parent in the wp_posts table for all events. I am not sure if this will be useful for others. I used the following plugin to insert the php code as a shortcode. You would copy the entire code into a new php shortcode provided by the plugin. https://wordpress.org/plugins/custom-css-js-php/. Please enter all your wordpress config information which can be found in the config file for the wordpress website. After you add this php code it generates a shortcode. You can add it to a page called break or any page you want to use. Just remember that it needs to have that same page in the custom function listed on step 2.

    <?php

    $conn = mysqli_connect(“localhost or Server Name”, “DB User”, “DB Password”, “Database Name”);

    $eventBreak = “DELETE
    FROM Enter Database Name Here.wp_postmeta
    WHERE meta_key LIKE ‘_eventrecurrence'”;

    $eventUpdate = “UPDATE Enter Database Name Here.wp_posts SET post_parent = ‘0’WHERE post_type LIKE ‘tribe_events'”;

    $deleteResult = mysqli_query($conn , $eventBreak);
    $updateResult = mysqli_query($conn , $eventUpdate);

    echo “All done. Please remember to add your tickets!”;
    ?>

    Step 2 – Create a button or custom function to allow easy execution of the queries. I accomplished this using this plugin to write a custom function and create a button.
    https://wordpress.org/plugins/my-custom-functions/. This will allow you to add the custom function and button to the top admin bar. I just labeled it accordingly and pointed it to a page that executes the php shortcode and queries.

    /* Adding Button For Breaking Event Series */

    function break_event_series($wp_admin_bar){
    $args = array(
    ‘id’ => ‘event-series-break’,
    ‘title’ => ‘Convert Event Series’,
    ‘href’ => ‘http://trachmasters.com/break&#8217;,
    ‘meta’ => array(
    ‘class’ => ‘event-series-break’
    )
    );
    $wp_admin_bar->add_node($args);
    }
    add_action(‘admin_bar_menu’, ‘break_event_series’, 50);

    I know this may not solve all of it. But I hope it helps. Please let me know if this seems like something that could help others.

    Thanks,

    Jon

    #1186383
    Andras
    Keymaster

    Hey Jon,

    Wow, major and awesome work there!!! Big kudos for sharing that, indeed, I’m sure it will be helpful for others as well.

    Regarding the flow, at the moment I believe there is no simpler way to do it. You do need the 2 steps in the database. I will paste the 2 Sql queries here again in a bit more readable format.

    $eventBreak = “DELETE FROM database_name.wp_postmeta WHERE meta_key LIKE ‘_eventrecurrence’ “;

    $eventUpdate = “UPDATE database_name.wp_posts SET post_parent = ‘0’ WHERE post_type
    LIKE ‘tribe_events’ “;

     

    Thanks again for this awesomeness! Keep rockin’!

    Let me know if there is anything else in this topic I can help with, or if I can close it down.

    Thanks and cheers,
    Andras

    #1197041
    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 ‘Break Recurring Event’ is closed to new replies.