Gocodebox_Banner_Notifier::notification_test_pmpro_num_levels( bool $value, array $data )
PMPro number of levels test.
Contents
Parameters Parameters
- $value
-
(bool) (Required) The current test value.
- $data
-
(array) (Required) Array from the notification with [0] comparison operator and [1] number of levels.
Source Source
File: libraries/banner-notifications/src/notifications.php
function notification_test_pmpro_num_levels( $value, $data ) {
global $wpdb;
static $num_levels;
if ( ! function_exists( 'pmpro_int_compare' ) ) {
return false;
}
if ( ! is_array( $data ) || ! isset( $data[0] ) || ! isset( $data[1] ) ) {
return false;
}
if ( ! isset( $num_levels ) ) {
$sqlQuery = "SELECT COUNT(*) FROM $wpdb->pmpro_membership_levels";
$num_levels = $wpdb->get_var( $sqlQuery );
}
return pmpro_int_compare( $num_levels, $data[1], $data[0] );
}
Expand full source code Collapse full source code View on GitHub