LLMS_Admin_Tool_Limited_Billing_Order_Locator::generate_csv()

Query the database for orders that may be affected by the change.


Return Return

(array[]) Returns an array of arrays where each array represents a line in the generated CSV file.


Top ↑

Source Source

File: includes/admin/tools/class-llms-admin-tool-limited-billing-order-locator.php

	protected function generate_csv() {

		$csv = array();

		$orders = new WP_Query(
			array(
				'post_type'      => 'llms_order',
				'post_status'    => array( 'llms-active', 'llms-on-hold' ),
				'posts_per_page' => -1,
				'orderby'        => 'ID',
				'meta_query'     => array(
					array(
						'key'     => '_llms_billing_length',
						'value'   => 1,
						'compare' => '>=',
					),
					array(
						'key'     => '_llms_date_billing_end',
						'compare' => 'EXISTS',
					),
				),
			)
		);

		foreach ( $orders->posts as $order ) {

			$order = llms_get_post( $order );
			if ( ! $order || ! is_a( $order, 'LLMS_Order' ) ) {
				continue;
			}

			$csv[] = $this->get_order_csv( $order );

		}

		return array_filter( $csv );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.4.0 Retrieve orders ordered by their unique ID (DESC) instead of the default date_created.
5.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.