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

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


Top ↑

Source Source

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

	function notification_test_pmpro_num_members( $value, $data ) {
		global $wpdb;
		static $num_members;

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

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

		if ( ! isset( $num_members ) ) {
			$sqlQuery    = "SELECT COUNT(*) FROM ( SELECT user_id FROM $wpdb->pmpro_memberships_users WHERE status = 'active' GROUP BY user_id ) t1";
			$num_members = $wpdb->get_var( $sqlQuery );
		}

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

Top ↑

User Contributed Notes User Contributed Notes

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