Process all recurring events immediately

Home Forums Calendar Products Events Calendar PRO Process all recurring events immediately

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1546344
    maxwidth
    Participant

    My Client wants functionality to upload past events with their registrations (RTEC). Hereby it loads the events into the DB using your “updateRecurrenceMeta” function under the Tribe__Events__Pro__Recurrence__Meta Class. Afterwards all the registrations for those events are inserted.

    The problem is that some of the events do not yet exist since the Events Calendar PRO plugin does only insert some events and queues others for later insert.

    How can I change that and make Events Calendar PRO to process all recurring events immediately? Is there any callback when the process is done?

    Thanks you very much for a quick hint.
    Matthias

    #1547109
    maxwidth
    Participant

    I hooked into the values for “tribe_events_pro_recurrence_small_batch_size” or “tribe_events_pro_recurrence_batch_size” and increased them to 500 but it didnt solve it. Nor when I call “save_pending_events” (it says that there is no ‘_EventNextPendingRecurrence’) and returns.

    It took me 3 days to find out that the “only small batch-size insert” of The Events Calendar is actually the issue for the problem why my upload functionality does not work. And now since I know the issue, I just cant get it to work (doesnt speek for me for being a good web developer – I know)

    I would very much appreciate it, if somebody could give me just a little hint. Thank you very much.

    #1547171
    Andras
    Keymaster

    Hi Matthias,

    Thanks for reaching out to us!

    This is a bit beyond me but I will ping the team so someone can drop you a hint if and how that’s possible. Please hang in there.

    In the meantime please give us more details on the process of importing past events. Are you uploading / importing a csv file or do you have some custom code in place. How to the events get into the database? The more details you can share with us the easier it will be to point you in the right direction.

    Thanks,
    Andras

    #1547290
    maxwidth
    Participant

    Thanks Andras for your reply. increasing tribe_events_pro_recurrence_small_batch_size did not solve the problem because there was another issue that recurring dates could not be younger than the original parent date. Once I changed all parent dates to somewhen 50 years ago, it did work.

    #1548193
    Andras
    Keymaster

    Hi,

    I have received some input from my colleagues.

    Assuming timeouts aren’t a problem on your server, or it’s executed via WP CLI, this will build 250 or however many instances are specified. Might be a useful starting point.

    $description   = wp_remote_retrieve_body( wp_remote_get( 'http://loripsum.net/api/4/medium' ) );
    $start_date    = date_create()->modify( '+2 days' )->format( 'Y-m-d' );
    
    $post_id = Tribe__Events__API::createEvent( [
        'post_title'       => 'Mary Poppins Revival',
        'post_content'     => $description,
        'post_status'      => 'publish',
        'EventStartDate'   => $start_date,
        'EventEndDate'     => $start_date,
        'EventStartHour'   => 16,
        'EventEndHour'     => 17,
        'EventStartMinute' => 0,
        'EventEndMinute'   => 0,
        'recurrence'       => [
            'rules' => [
                [
                    'type'      => 'Every Day',
                    'end-type'  => 'After',
                    'end'       => null,
                    'end-count' => 250,
                ],
            ],
        ],
    ] );
    
    
    $processor = new Tribe__Events__Pro__Recurrence__Queue_Processor;
    $processor->process_queue( PHP_INT_MAX );
    

    Sidenote: the queue processor will look at other series besides the one that was just created, however it is essentially possible to tell it to process everything that is waiting by passing a very high value as the batch size (in the example, ‘PHP_INT_MAX’ – but you could adjust to something smaller if preferred.

    If this doesn’t help, then we can try to help you further. For that we would need to see your actual code.

    Also I would like to point out that this is essentially a custom development task and so is outside of our stated scope of support. We do need to prioritize support requests from other customers at this time but I’ll certainly flag this with the team and – although we can’t make any promises – if we have time and space to come back and help, we’ll be happy to do so.

    If you urgently need help with this, however, you may instead wish to consider working with a suitably skilled developer or designer who can offer the additional level of support you require.

    Cheers,
    Andras

    #1564585
    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 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Process all recurring events immediately’ is closed to new replies.