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

PMPro number of orders 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 orders.


Top ↑

Source Source

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

	function notification_test_pmpro_num_orders( $value, $data ) {
		global $wpdb;
		static $num_orders;

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

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

		if ( ! isset( $num_orders ) ) {
			$sqlQuery   = "SELECT COUNT(*) FROM $wpdb->pmpro_membership_orders WHERE gateway_environment = 'live' AND status NOT IN('refunded', 'review', 'token', 'error')";
			$num_orders = $wpdb->get_var( $sqlQuery );
		}

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

Top ↑

User Contributed Notes User Contributed Notes

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