Gocodebox_Banner_Notifier::notification_test_pmpro_revenue( bool $value, array $data )
PMPro revenue test.
Contents
Parameters Parameters
- $value
-
(bool) (Required) The current test value.
- $data
-
(array) (Required) Array from the notification with [0] comparison operator and [1] revenue.<br>Optionally $data can contain a third parameter to also check the currency code.
Source Source
File: libraries/banner-notifications/src/notifications.php
function notification_test_pmpro_revenue( $value, $data ) {
global $wpdb;
static $revenue;
if ( ! function_exists( 'pmpro_int_compare' ) ) {
return false;
}
if ( ! is_array( $data ) || ! isset( $data[0] ) || ! isset( $data[1] ) ) {
return false;
}
if ( ! isset( $revenue ) ) {
$sqlQuery = "SELECT SUM(total) FROM $wpdb->pmpro_membership_orders WHERE gateway_environment = 'live' AND status NOT IN('refunded', 'review', 'token', 'error')";
$revenue = $wpdb->get_var( $sqlQuery );
}
return pmpro_int_compare( $revenue, $data[1], $data[0] );
}
Expand full source code Collapse full source code View on GitHub