llms_update_3120_update_order_end_dates()
Add end dates to LifterLMS Orders which have a length but no saved end date
Return Return
(void)
Source Source
File: includes/functions/updates/llms-functions-updates-3120.php
function llms_update_3120_update_order_end_dates() {
global $wpdb;
$ids = $wpdb->get_col(
"SELECT posts.ID
FROM {$wpdb->posts} AS posts
JOIN {$wpdb->postmeta} AS meta1 ON meta1.post_id = posts.ID AND meta1.meta_key = '_llms_billing_length'
LEFT JOIN {$wpdb->postmeta} AS meta2 ON meta2.post_id = posts.ID AND meta2.meta_key = '_llms_date_billing_end'
WHERE posts.post_type = 'llms_order'
AND meta2.meta_value IS NULL
AND meta1.meta_value > 0;"
); // db call ok; no-cache ok.
foreach ( $ids as $id ) {
$order = llms_get_post( $id );
if ( ! is_a( $order, 'LLMS_Order' ) ) {
continue;
}
$order->maybe_schedule_payment( true );
}
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.12.0 | Introduced. |