LLMS_Admin_Tool_Recurring_Payment_Rescheduler::query_orders()
Perform a DB query for orders to be handled by the tool
Return Return
(object[])
Source Source
File: includes/admin/tools/class-llms-admin-tool-recurring-payment-rescheduler.php
protected function query_orders() {
global $wpdb;
$orders = $wpdb->get_results(
"SELECT SQL_CALC_FOUND_ROWS p.ID
FROM {$wpdb->posts} AS p
LEFT JOIN {$wpdb->postmeta} AS m
ON p.ID = m.post_ID
AND m.meta_key = '_llms_plan_ended'
LEFT JOIN {$wpdb->prefix}actionscheduler_actions AS a
ON a.args = CONCAT( '{\"order_id\":', p.ID, '}' )
AND a.hook = 'llms_charge_recurring_payment'
AND a.status = 'pending'
WHERE 1
AND p.post_type = 'llms_order'
AND p.post_status = 'llms-active'
AND a.action_id IS NULL
AND m.meta_value IS NULL
ORDER BY p.ID ASC
LIMIT 50
;"
); // no-cache ok -- Caching implemented in `get_orders()`.
wp_cache_set( sprintf( '%s-total-results', $this->id ), $wpdb->get_var( 'SELECT FOUND_ROWS()' ), 'llms_tool_data' );
return $orders;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 4.7.0 | Added SQL_CALC_FOUND_ROWS and improved query to exclude results with a completed payment plan. |
| 4.6.0 | Introduced. |