LLMS_Voucher::get_voucher_codes( string $format = 'OBJECT' )

Get a list of voucher codes


Parameters Parameters

$format

(string) (Optional) Return format.

Default value: 'OBJECT'


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/class.llms.voucher.php

	public function get_voucher_codes( $format = 'OBJECT' ) {

		global $wpdb;

		$table          = $this->get_codes_table_name();
		$redeemed_table = $this->get_redemptions_table_name();

		$query = "SELECT c.*, count(r.id) as used
                  FROM $table as c
                  LEFT JOIN $redeemed_table as r
                  ON c.`id` = r.`code_id`
                  WHERE `voucher_id` = $this->id AND `is_deleted` = 0
                  GROUP BY c.id";
		return $wpdb->get_results( $query, $format );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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