LLMS_Processor_Table_To_Csv::dispatch_generation( string $handler, int $user_id,  $args = array() )

Action triggered to queue queries needed to generate the CSV


Description Description


Parameters Parameters

$handler

(string) (Required) LLMS_Table Handler name

$user_id

(int) (Required) WP User ID of the user who initiated the export


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/processors/class.llms.processor.table.to.csv.php

	public function dispatch_generation( $handler, $user_id, $args = array() ) {

		$this->log( sprintf( 'csv generation dispatched for table %s', $handler ) );

		$table = $this->get_handler( $handler );

		if ( $table ) {

			// set the user to be the initiating user so the table will have the correct data
			wp_set_current_user( $user_id );

			$args = wp_parse_args( $args, array(
				'_processor' => array(
					'file' => LLMS_TMP_DIR . $table->get_export_file_name( $args ) . '.csv',
					'handler' => get_class( $table ),
					'user_id' => $user_id,
				),
			) );

			$args['page'] = 1; // always start at one
			$args['per_page'] = 250; // if supported, do more than the displayed / page count

			$table->get_results( $args );

			while ( $args['page'] <= $table->get_max_pages() ) {

				$this->push_to_queue( $args );
				$args['page']++;

			}

			// save queue and dispatch the process
			$this->save()->dispatch();

			$this->log( sprintf( 'csv generation started for table %s', $handler ) );

		} else {

			$this->log( sprintf( 'handler %s does not exist', $handler ) );

		}

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.15.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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