Exemplo n.º 1
0
function eme_delete_location($location_id)
{
    global $wpdb;
    $table_name = $wpdb->prefix . LOCATIONS_TBNAME;
    $sql = $wpdb->prepare("DELETE FROM {$table_name} where location_id=%d", $location_id);
    $wpdb->query($sql);
    $events_table = $wpdb->prefix . EVENTS_TBNAME;
    $sql = $wpdb->prepare("UPDATE {$events_table} SET location_id=0 WHERE location_id = %d", $location_id);
    $wpdb->query($sql);
    $image_basename = IMAGE_UPLOAD_DIR . "/location-" . $location_id;
    eme_delete_image_files($image_basename);
}
Exemplo n.º 2
0
function eme_db_delete_recurrence($event, $recurrence)
{
    global $wpdb;
    $recurrence_table = $wpdb->prefix . RECURRENCE_TBNAME;
    $recurrence_id = $recurrence['recurrence_id'];
    $sql = $wpdb->prepare("DELETE FROM {$recurrence_table} WHERE recurrence_id = %d", $recurrence_id);
    $wpdb->query($sql);
    eme_remove_events_for_recurrence_id($recurrence_id);
    $image_basename = IMAGE_UPLOAD_DIR . "/recurrence-" . $recurrence_id;
    eme_delete_image_files($image_basename);
    if (has_action('eme_delete_recurrence_action')) {
        do_action('eme_delete_recurrence_action', $event, $recurrence);
    }
}
Exemplo n.º 3
0
function eme_db_delete_event($event, $event_is_part_of_recurrence = 0)
{
    global $wpdb;
    $table_name = $wpdb->prefix . EVENTS_TBNAME;
    $wpdb->show_errors(false);
    $sql = $wpdb->prepare("DELETE FROM {$table_name} WHERE event_id = %d", $event['event_id']);
    // also delete associated image
    $image_basename = IMAGE_UPLOAD_DIR . "/event-" . $event['event_id'];
    eme_delete_image_files($image_basename);
    if ($wpdb->query($sql)) {
        eme_delete_all_bookings_for_event_id($event['event_id']);
        // the eme_delete_event_action is only executed for single events, not those part of a recurrence
        if (!$event_is_part_of_recurrence && has_action('eme_delete_event_action')) {
            do_action('eme_delete_event_action', $event);
        }
    }
}