LLMS_Voucher::get_redeemed_codes( $format = 'OBJECT' )

Redeemed Codes

Return Return


Top ↑

Source Source

File: includes/class.llms.voucher.php

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

		global $wpdb;

		$table          = $this->get_codes_table_name();
		$redeemed_table = $this->get_redemptions_table_name();
		$users_table    = $wpdb->prefix . 'users';

		$query = "SELECT r.`id`, c.`id` as code_id, c.`voucher_id`, c.`code`, c.`redemption_count`, r.`user_id`, u.`user_email`, r.`redemption_date`
                  FROM $table as c
                  JOIN $redeemed_table as r
                  ON c.`id` = r.`code_id`
                  JOIN $users_table as u
                  ON r.`user_id` = u.`ID`
                  WHERE c.`is_deleted` = 0 AND c.`voucher_id` = $this->id";

		return $wpdb->get_results( $query, $format );

Top ↑

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.