当前位置: 首页>>代码示例>>PHP>>正文


PHP BP_Groups_Group::get_group_type_ids方法代码示例

本文整理汇总了PHP中BP_Groups_Group::get_group_type_ids方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Groups_Group::get_group_type_ids方法的具体用法?PHP BP_Groups_Group::get_group_type_ids怎么用?PHP BP_Groups_Group::get_group_type_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BP_Groups_Group的用法示例。


在下文中一共展示了BP_Groups_Group::get_group_type_ids方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: prepare_items

 /**
  * Set up items for display in the list table.
  *
  * Handles filtering of data, sorting, pagination, and any other data
  * manipulation required prior to rendering.
  *
  * @since 1.7.0
  */
 public function prepare_items()
 {
     global $groups_template;
     $screen = get_current_screen();
     // Option defaults
     $include_id = false;
     $search_terms = false;
     // Set current page
     $page = $this->get_pagenum();
     // Set per page from the screen options
     $per_page = $this->get_items_per_page(str_replace('-', '_', "{$screen->id}_per_page"));
     // Sort order.
     $order = 'DESC';
     if (!empty($_REQUEST['order'])) {
         $order = 'desc' == strtolower($_REQUEST['order']) ? 'DESC' : 'ASC';
     }
     // Order by - default to newest
     $orderby = 'last_activity';
     if (!empty($_REQUEST['orderby'])) {
         switch ($_REQUEST['orderby']) {
             case 'name':
                 $orderby = 'name';
                 break;
             case 'id':
                 $orderby = 'date_created';
                 break;
             case 'members':
                 $orderby = 'total_member_count';
                 break;
             case 'last_active':
                 $orderby = 'last_activity';
                 break;
         }
     }
     // Are we doing a search?
     if (!empty($_REQUEST['s'])) {
         $search_terms = $_REQUEST['s'];
     }
     // Check if user has clicked on a specific group (if so, fetch only that group).
     if (!empty($_REQUEST['gid'])) {
         $include_id = (int) $_REQUEST['gid'];
     }
     // Set the current view
     if (isset($_GET['group_status']) && in_array($_GET['group_status'], array('public', 'private', 'hidden'))) {
         $this->view = $_GET['group_status'];
     }
     // We'll use the ids of group types for the 'include' param
     $this->group_type_ids = BP_Groups_Group::get_group_type_ids();
     // Pass a dummy array if there are no groups of this type
     $include = false;
     if ('all' != $this->view && isset($this->group_type_ids[$this->view])) {
         $include = !empty($this->group_type_ids[$this->view]) ? $this->group_type_ids[$this->view] : array(0);
     }
     // Get group type counts for display in the filter tabs
     $this->group_counts = array();
     foreach ($this->group_type_ids as $group_type => $group_ids) {
         $this->group_counts[$group_type] = count($group_ids);
     }
     // If we're viewing a specific group, flatten all activities into a single array.
     if ($include_id) {
         $groups = array((array) groups_get_group('group_id=' . $include_id));
     } else {
         $groups_args = array('include' => $include, 'per_page' => $per_page, 'page' => $page, 'orderby' => $orderby, 'order' => $order);
         $groups = array();
         if (bp_has_groups($groups_args)) {
             while (bp_groups()) {
                 bp_the_group();
                 $groups[] = (array) $groups_template->group;
             }
         }
     }
     // Set raw data to display
     $this->items = $groups;
     // Store information needed for handling table pagination
     $this->set_pagination_args(array('per_page' => $per_page, 'total_items' => $groups_template->total_group_count, 'total_pages' => ceil($groups_template->total_group_count / $per_page)));
 }
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:84,代码来源:bp-groups-admin.php


注:本文中的BP_Groups_Group::get_group_type_ids方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。