LLMS_Voucher::is_code_duplicate( string[] $codes )

Dupcheck generated voucher codes.


Parameters Parameters

$codes

(string[]) (Required) Array of voucher code strings.


Top ↑

Return Return

(boolean)


Top ↑

Source Source

File: includes/class.llms.voucher.php

	public function is_code_duplicate( $codes ) {

		global $wpdb;
		$codes_as_string = join( '","', $codes );
		// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
		$codes = $wpdb->get_results(
			$wpdb->prepare(
				"SELECT code
             FROM {$this->get_codes_table_name()}
             WHERE code IN ( {$codes_as_string} )
               AND voucher_id != %d",
				array( $this->id )
			),
			ARRAY_A
		);
		// phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared

		if ( count( $codes ) ) {
			return $codes;
		}

		return false;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.35.0 Prepare SQL.
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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