Haus – SuyaJerks Old School Haus – Old School, Rnb & Hip Hop Brunch
Cococure Haus Stratford 27 Broadway, London, United KingdomExperience the ultimate throwback at Old School R&B Brunch at [...]
public function handle_event_duplication() { try { if (!isset($_POST['duplicate_events_weekly_nonce']) || !wp_verify_nonce($_POST['duplicate_events_weekly_nonce'], 'duplicate_events_weekly_nonce')) { wp_die('Invalid request'); } if (empty($_POST['event_ids'])) { wp_redirect(add_query_arg( ['page' => 'batch-event-duplicator', 'error' => 'no-events'], admin_url('edit.php?post_type=tribe_events') )); exit; } $event_ids = array_map('intval', $_POST['event_ids']); $duplicated = 0; $errors = 0; foreach ($event_ids as $event_id) { try { // Store original event details $original_event = get_post($event_id); if (!$original_event) { error_log("Event duplicator: Original event {$event_id} not found"); $errors++; continue; } $original_title = $original_event->post_title; // Generate duplication URL $nonce = wp_create_nonce('tec-events-pro-duplicate-event'); $duplicate_url = admin_url("admin.php?action=tec_events_pro_duplicate_event&post_id={$event_id}&_wpnonce={$nonce}"); error_log("Event duplicator: Attempting to duplicate event {$event_id}"); // Perform duplication $response = wp_remote_get($duplicate_url); if (is_wp_error($response)) { error_log("Event duplicator: WP Error during duplication - " . $response->get_error_message()); $errors++; continue; } $response_code = wp_remote_retrieve_response_code($response); if ($response_code !== 200) { error_log("Event duplicator: Bad response code {$response_code}"); $errors++; continue; } // Wait briefly for the duplication to complete sleep(2); // Find the newly created event $new_event = $this->find_duplicate_event($original_title, $event_id); if (!$new_event) { error_log("Event duplicator: Could not find newly created event for {$event_id}"); $errors++; continue; } error_log("Event duplicator: Found new event {$new_event->ID}"); // Update the dates if ($this->update_event_dates($new_event->ID, $event_id)) { $duplicated++; error_log("Event duplicator: Successfully updated dates for event {$new_event->ID}"); } else { error_log("Event duplicator: Failed to update dates for event {$new_event->ID}"); $errors++; } } catch (Exception $e) { error_log("Event duplicator: Exception during event {$event_id} duplication - " . $e->getMessage()); $errors++; continue; } } error_log("Event duplicator: Completed with {$duplicated} successes and {$errors} errors"); // Safe redirect back to the events page $redirect_url = add_query_arg( [ 'post_type' => 'tribe_events', 'page' => 'batch-event-duplicator', 'duplicated' => $duplicated, 'errors' => $errors ], admin_url('edit.php') ); error_log("Event duplicator: Redirecting to {$redirect_url}"); wp_safe_redirect($redirect_url); exit; } catch (Exception $e) { error_log("Event duplicator: Critical error - " . $e->getMessage()); wp_die('An error occurred while duplicating events. Please check the error logs.'); } }
Experience the ultimate throwback at Old School R&B Brunch at [...]
Introducing "Brunch Beats: Saturday Afrobeats & Rum Punch Bash" – [...]
Experience the ultimate throwback at Old School R&B Brunch at [...]
Introducing "Brunch Beats: Saturday Afrobeats & Rum Punch Bash" – [...]
Experience the ultimate throwback at Old School R&B Brunch at [...]
Introducing "Brunch Beats: Saturday Afrobeats & Rum Punch Bash" – [...]
Experience the ultimate throwback at Old School R&B Brunch at [...]
Introducing "Brunch Beats: Saturday Afrobeats & Rum Punch Bash" – [...]
Experience the ultimate throwback at Old School R&B Brunch at [...]
Introducing "Brunch Beats: Saturday Afrobeats & Rum Punch Bash" – [...]
Experience the ultimate throwback at Old School R&B Brunch at [...]
Introducing "Brunch Beats: Saturday Afrobeats & Rum Punch Bash" – [...]
Experience the ultimate throwback at Old School R&B Brunch at [...]
Introducing "Brunch Beats: Saturday Afrobeats & Rum Punch Bash" – [...]
Experience the ultimate throwback at Old School R&B Brunch at [...]
Introducing "Brunch Beats: Saturday Afrobeats & Rum Punch Bash" – [...]