BP_Optout::get_total_count( array $args )

Get a count of total optouts matching a set of arguments.


Description Description

See also See also


Top ↑

Parameters Parameters

$args

(array) (Required) See BP_optout::get().


Top ↑

Return Return

(int) Count of located items.


Top ↑

Source Source

File: bp-core/classes/class-bp-optout.php

	public static function get_total_count( $args ) {
		global $wpdb;
		$optouts_table_name = BP_Optout::get_table_name();

		// Parse the arguments.
		$r  = bp_parse_args(
			$args,
			array(
				'id'            => false,
				'email_address' => false,
				'user_id'       => false,
				'email_type'    => false,
				'search_terms'  => '',
				'order_by'      => false,
				'sort_order'    => false,
				'page'          => false,
				'per_page'      => false,
				'fields'        => 'all',
			),
			'bp_optout_get_total_count'
		);

		// Build the query
		$select_sql = "SELECT COUNT(*)";
		$from_sql   = "FROM {$optouts_table_name}";
		$where_sql  = self::get_where_sql( $r );
		$sql        = "{$select_sql} {$from_sql} {$where_sql}";

		// Return the queried results
		return $wpdb->get_var( $sql );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
8.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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