本文整理汇总了PHP中MS_Model_Member::get_members_count方法的典型用法代码示例。如果您正苦于以下问题:PHP MS_Model_Member::get_members_count方法的具体用法?PHP MS_Model_Member::get_members_count怎么用?PHP MS_Model_Member::get_members_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MS_Model_Member
的用法示例。
在下文中一共展示了MS_Model_Member::get_members_count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare_items
/**
* Prepare list items.
*
* @since 1.0.0
*/
public function prepare_items()
{
$this->_column_headers = array($this->get_columns(), array(), $this->get_sortable_columns());
$per_page = apply_filters('ms_helper_listtable_member_items_per_page', self::DEFAULT_PAGE_SIZE);
$current_page = $this->get_pagenum();
$args = array('number' => $per_page, 'offset' => ($current_page - 1) * $per_page);
// Prepare the filter details.
$args = $this->prepare_query_args($args);
$total_items = MS_Model_Member::get_members_count($args);
$this->items = MS_Model_Member::get_members($args);
$this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page));
do_action('ms_helper_listtable_member_prepare_items', $args, $this);
}
示例2: get_views
/**
* This list has no views.
*
* @since 1.0.2.0
*
* @return array
*/
public function get_views()
{
$views = array();
$args = array();
$count = 0;
$views['label'] = array('label' => __('Subscription Status:', 'membership2'));
if (empty($_REQUEST['membership_id'])) {
// All users
$url = esc_url_raw(add_query_arg('status', 'all'));
$views['all'] = array('url' => $url, 'label' => __('All users', 'membership2'));
} else {
$args['membership_id'] = $_REQUEST['membership_id'];
}
// Active, Trial, Cancelled
$url = esc_url_raw(remove_query_arg('status'));
$args['subscription_status'] = MS_Model_Relationship::STATUS_ACTIVE;
$count = MS_Model_Member::get_members_count($args);
$views['active'] = array('url' => $url, 'label' => __('Active subscription', 'membership2'), 'count' => $count);
// Cancelled
$url = esc_url_raw(add_query_arg('status', MS_Model_Relationship::STATUS_CANCELED));
$args['subscription_status'] = MS_Model_Relationship::STATUS_CANCELED;
$count = MS_Model_Member::get_members_count($args);
$views['cancelled'] = array('url' => $url, 'label' => __('Cancelled', 'membership2'), 'count' => $count);
// Trial
if (MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_TRIAL)) {
$url = esc_url_raw(add_query_arg('status', MS_Model_Relationship::STATUS_TRIAL));
$args['subscription_status'] = MS_Model_Relationship::STATUS_TRIAL;
$count = MS_Model_Member::get_members_count($args);
$views['trial'] = array('url' => $url, 'label' => __('Trial', 'membership2'), 'count' => $count);
}
// Expired, Trial-Expired
$url = esc_url_raw(add_query_arg('status', 'expired'));
$args['subscription_status'] = 'expired';
$count = MS_Model_Member::get_members_count($args);
$views['expired'] = array('url' => $url, 'label' => __('Expired', 'membership2'), 'count' => $count);
return $views;
}