Gocodebox_Banner_Notifier::notification_test_pmpro_num_discount_codes( bool $value, array $data )

PMPro number of discount codes test.


Parameters Parameters

$value

(bool) (Required) The current test value.

$data

(array) (Required) Array from the notification with [0] comparison operator and [1] number of discount codes.


Top ↑

Source Source

File: libraries/banner-notifications/src/notifications.php

	function notification_test_pmpro_num_discount_codes( $value, $data ) {
		global $wpdb;
		static $num_codes;

		if ( ! function_exists( 'pmpro_int_compare' ) ) {
			return false;
		}

		if ( ! is_array( $data ) || ! isset( $data[0] ) || ! isset( $data[1] ) ) {
			return false;
		}

		if ( ! isset( $num_codes ) ) {
			$sqlQuery  = "SELECT COUNT(*) FROM $wpdb->pmpro_discount_codes";
			$num_codes = $wpdb->get_var( $sqlQuery );
		}

		return pmpro_int_compare( $num_codes, $data[1], $data[0] );
	}

Top ↑

User Contributed Notes User Contributed Notes

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