Changeset 10767
- Timestamp:
- 05/15/2016 02:30:51 AM (9 years ago)
- Location:
- trunk/src/bp-groups
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-functions.php
r10766 r10767 698 698 699 699 $defaults = array( 700 'type' => false, // Active, newest, alphabetical, random, popular, most-forum-topics or most-forum-posts.701 'order' => 'DESC', // 'ASC' or 'DESC'702 'orderby' => 'date_created', // date_created, last_activity, total_member_count, name, random.703 'user_id' => false, // Pass a user_id to limit to only groups that this user is a member of.704 'include' => false, // Only include these specific groups (group_ids).705 'exclude' => false, // Do not include these specific groups (group_ids).706 'search_terms' => false, // Limit to groups that match these search terms.700 'type' => false, // Active, newest, alphabetical, random, popular, most-forum-topics or most-forum-posts. 701 'order' => 'DESC', // 'ASC' or 'DESC' 702 'orderby' => 'date_created', // date_created, last_activity, total_member_count, name, random. 703 'user_id' => false, // Pass a user_id to limit to only groups that this user is a member of. 704 'include' => false, // Only include these specific groups (group_ids). 705 'exclude' => false, // Do not include these specific groups (group_ids). 706 'search_terms' => false, // Limit to groups that match these search terms. 707 707 'group_type' => '', 708 708 'group_type__in' => '', 709 709 'group_type__not_in' => '', 710 'meta_query' => false, // Filter by groupmeta. See WP_Meta_Query for syntax.711 'show_hidden' => false, // Show hidden groups to non-admins.712 'per_page' => 20, // The number of results to return per page.713 'page' => 1, // The page to return if limiting per page.714 'populate_extras' => true, // Fetch meta such as is_banned and is_member.715 'update_meta_cache' => true, // Pre-fetch groupmeta for queried groups.710 'meta_query' => false, // Filter by groupmeta. See WP_Meta_Query for syntax. 711 'show_hidden' => false, // Show hidden groups to non-admins. 712 'per_page' => 20, // The number of results to return per page. 713 'page' => 1, // The page to return if limiting per page. 714 'populate_extras' => true, // Fetch meta such as is_banned and is_member. 715 'update_meta_cache' => true, // Pre-fetch groupmeta for queried groups. 716 716 ); 717 717 … … 719 719 720 720 $groups = BP_Groups_Group::get( array( 721 'type' => $r['type'],722 'user_id' => $r['user_id'],723 'include' => $r['include'],724 'exclude' => $r['exclude'],725 'search_terms' => $r['search_terms'],721 'type' => $r['type'], 722 'user_id' => $r['user_id'], 723 'include' => $r['include'], 724 'exclude' => $r['exclude'], 725 'search_terms' => $r['search_terms'], 726 726 'group_type' => $r['group_type'], 727 727 'group_type__in' => $r['group_type__in'], 728 728 'group_type__not_in' => $r['group_type__not_in'], 729 'meta_query' => $r['meta_query'],730 'show_hidden' => $r['show_hidden'],731 'per_page' => $r['per_page'],732 'page' => $r['page'],733 'populate_extras' => $r['populate_extras'],734 'update_meta_cache' => $r['update_meta_cache'],735 'order' => $r['order'],736 'orderby' => $r['orderby'],729 'meta_query' => $r['meta_query'], 730 'show_hidden' => $r['show_hidden'], 731 'per_page' => $r['per_page'], 732 'page' => $r['page'], 733 'populate_extras' => $r['populate_extras'], 734 'update_meta_cache' => $r['update_meta_cache'], 735 'order' => $r['order'], 736 'orderby' => $r['orderby'], 737 737 ) ); 738 738 -
trunk/src/bp-groups/bp-groups-template.php
r10766 r10767 107 107 * @param array|string $args { 108 108 * Array of parameters. All items are optional. 109 * @type string $type Shorthand for certain orderby/ 110 * order combinations. 'newest', 111 * 'active', 'popular', 'alphabetical', 112 * 'random'. When present, will override 113 * orderby and order params. Default: null. 114 * @type string $order Sort order. 'ASC' or 'DESC'. 115 * Default: 'DESC'. 116 * @type string $orderby Property to sort by. 117 * 'date_created', 'last_activity', 'total_member_count', 118 * 'name', 'random'. Default: 'last_activity'. 119 * @type int $page Page offset of results to return. 120 * Default: 1 (first page of results). 121 * @type int $per_page Number of items to return per page 122 * of results. Default: 20. 123 * @type int $max Does NOT affect query. May change the 124 * reported number of total groups found, 125 * but not the actual number of found 126 * groups. Default: false. 127 * @type bool $show_hidden Whether to include hidden groups in 128 * results. Default: false. 129 * @type string $page_arg Query argument used for pagination. 130 * Default: 'grpage'. 131 * @type int $user_id If provided, results will be limited 132 * to groups of which the specified user 133 * is a member. 134 * Default: value of bp_displayed_user_id(). 135 * @type string $slug If provided, only the group with the 136 * matching slug will be returned. 137 * Default: false. 138 * @type string $search_terms If provided, only groups whose names or 139 * descriptions match the search terms will 140 * be returned. Default: value of 141 * `$_REQUEST['groups_search']` or 142 * `$_REQUEST['s']`, if present. Otherwise false. 109 * @type string $type Shorthand for certain orderby/order combinations. 'newest', 'active', 110 * 'popular', 'alphabetical', 'random'. When present, will override 111 * orderby and order params. Default: null. 112 * @type string $order Sort order. 'ASC' or 'DESC'. Default: 'DESC'. 113 * @type string $orderby Property to sort by. 'date_created', 'last_activity', 114 * 'total_member_count', 'name', 'random'. Default: 'last_activity'. 115 * @type int $page Page offset of results to return. Default: 1 (first page of results). 116 * @type int $per_page Number of items to return per page of results. Default: 20. 117 * @type int $max Does NOT affect query. May change the reported number of total groups 118 * found, but not the actual number of found groups. Default: false. 119 * @type bool $show_hidden Whether to include hidden groups in results. Default: false. 120 * @type string $page_arg Query argument used for pagination. Default: 'grpage'. 121 * @type int $user_id If provided, results will be limited to groups of which the specified 122 * user is a member. Default: value of bp_displayed_user_id(). 123 * @type string $slug If provided, only the group with the matching slug will be returned. 124 * Default: false. 125 * @type string $search_terms If provided, only groups whose names or descriptions match the search 126 * terms will be returned. Default: value of `$_REQUEST['groups_search']` or 127 * `$_REQUEST['s']`, if present. Otherwise false. 143 128 * @type array|string $group_type Array or comma-separated list of group types to limit results to. 144 129 * @type array|string $group_type__in Array or comma-separated list of group types to limit results to. 145 130 * @type array|string $group_type__not_in Array or comma-separated list of group types that will be 146 131 * excluded from results. 147 * @type array $meta_query An array of meta_query conditions. 148 * See {@link WP_Meta_Query::queries} for description. 149 * @type array|string $include Array or comma-separated list of 150 * group IDs. Results will be limited 151 * to groups within the list. Default: false. 152 * @type bool $populate_extras Whether to fetch additional information 153 * (such as member count) about groups. 154 * Default: true. 155 * @type array|string $exclude Array or comma-separated list of group IDs. 156 * Results will exclude the listed groups. 157 * Default: false. 158 * @type bool $update_meta_cache Whether to fetch groupmeta for queried groups. 159 * Default: true. 132 * @type array $meta_query An array of meta_query conditions. 133 * See {@link WP_Meta_Query::queries} for description. 134 * @type array|string $include Array or comma-separated list of group IDs. Results will be limited 135 * to groups within the list. Default: false. 136 * @type bool $populate_extras Whether to fetch additional information (such as member count) 137 * about groups. Default: true. 138 * @type array|string $exclude Array or comma-separated list of group IDs. Results will exclude 139 * the listed groups. Default: false. 140 * @type bool $update_meta_cache Whether to fetch groupmeta for queried groups. Default: true. 160 141 * } 161 142 * @return bool True if there are groups to display that match the params … … 201 182 // Parse defaults and requested arguments. 202 183 $r = bp_parse_args( $args, array( 203 'type' => $type,204 'order' => 'DESC',205 'orderby' => 'last_activity',206 'page' => 1,207 'per_page' => 20,208 'max' => false,209 'show_hidden' => false,210 'page_arg' => 'grpage',211 'user_id' => bp_displayed_user_id(),212 'slug' => $slug,213 'search_terms' => $search_terms,184 'type' => $type, 185 'order' => 'DESC', 186 'orderby' => 'last_activity', 187 'page' => 1, 188 'per_page' => 20, 189 'max' => false, 190 'show_hidden' => false, 191 'page_arg' => 'grpage', 192 'user_id' => bp_displayed_user_id(), 193 'slug' => $slug, 194 'search_terms' => $search_terms, 214 195 'group_type' => '', 215 196 'group_type__in' => '', 216 197 'group_type__not_in' => '', 217 'meta_query' => false,218 'include' => false,219 'exclude' => false,220 'populate_extras' => true,221 'update_meta_cache' => true,198 'meta_query' => false, 199 'include' => false, 200 'exclude' => false, 201 'populate_extras' => true, 202 'update_meta_cache' => true, 222 203 ), 'has_groups' ); 223 204 224 205 // Setup the Groups template global. 225 206 $groups_template = new BP_Groups_Template( array( 226 'type' => $r['type'],227 'order' => $r['order'],228 'orderby' => $r['orderby'],229 'page' => (int) $r['page'],230 'per_page' => (int) $r['per_page'],231 'max' => (int) $r['max'],232 'show_hidden' => $r['show_hidden'],233 'page_arg' => $r['page_arg'],234 'user_id' => (int) $r['user_id'],235 'slug' => $r['slug'],236 'search_terms' => $r['search_terms'],207 'type' => $r['type'], 208 'order' => $r['order'], 209 'orderby' => $r['orderby'], 210 'page' => (int) $r['page'], 211 'per_page' => (int) $r['per_page'], 212 'max' => (int) $r['max'], 213 'show_hidden' => $r['show_hidden'], 214 'page_arg' => $r['page_arg'], 215 'user_id' => (int) $r['user_id'], 216 'slug' => $r['slug'], 217 'search_terms' => $r['search_terms'], 237 218 'group_type' => $r['group_type'], 238 219 'group_type__in' => $r['group_type__in'], 239 220 'group_type__not_in' => $r['group_type__not_in'], 240 'meta_query' => $r['meta_query'],241 'include' => $r['include'],242 'exclude' => $r['exclude'],243 'populate_extras' => (bool) $r['populate_extras'],244 'update_meta_cache' => (bool) $r['update_meta_cache'],221 'meta_query' => $r['meta_query'], 222 'include' => $r['include'], 223 'exclude' => $r['exclude'], 224 'populate_extras' => (bool) $r['populate_extras'], 225 'update_meta_cache' => (bool) $r['update_meta_cache'], 245 226 ) ); 246 227 -
trunk/src/bp-groups/classes/class-bp-groups-group.php
r10766 r10767 688 688 * @param array $args { 689 689 * Array of parameters. All items are optional. 690 * @type string $type Optional. Shorthand for certain orderby/ 691 * order combinations. 'newest', 'active', 'popular', 692 * 'alphabetical', 'random'. When present, will override 693 * orderby and order params. Default: null. 694 * @type string $orderby Optional. Property to sort by. 695 * 'date_created', 'last_activity', 'total_member_count', 696 * 'name', 'random'. Default: 'date_created'. 697 * @type string $order Optional. Sort order. 'ASC' or 'DESC'. 698 * Default: 'DESC'. 699 * @type int $per_page Optional. Number of items to return per page 700 * of results. Default: null (no limit). 701 * @type int $page Optional. Page offset of results to return. 702 * Default: null (no limit). 703 * @type int $user_id Optional. If provided, results will be limited to groups 704 * of which the specified user is a member. Default: null. 705 * @type string $search_terms Optional. If provided, only groups whose names 706 * or descriptions match the search terms will be 707 * returned. Default: false. 690 * @type string $type Optional. Shorthand for certain orderby/order combinations. 691 * 'newest', 'active', 'popular', 'alphabetical', 'random'. 692 * When present, will override orderby and order params. 693 * Default: null. 694 * @type string $orderby Optional. Property to sort by. 'date_created', 'last_activity', 695 * 'total_member_count', 'name', 'random'. Default: 'date_created'. 696 * @type string $order Optional. Sort order. 'ASC' or 'DESC'. Default: 'DESC'. 697 * @type int $per_page Optional. Number of items to return per page of results. 698 * Default: null (no limit). 699 * @type int $page Optional. Page offset of results to return. 700 * Default: null (no limit). 701 * @type int $user_id Optional. If provided, results will be limited to groups 702 * of which the specified user is a member. Default: null. 703 * @type string $search_terms Optional. If provided, only groups whose names or descriptions 704 * match the search terms will be returned. Default: false. 708 705 * @type array|string $group_type Array or comma-separated list of group types to limit results to. 709 706 * @type array|string $group_type__in Array or comma-separated list of group types to limit results to. 710 707 * @type array|string $group_type__not_in Array or comma-separated list of group types that will be 711 708 * excluded from results. 712 * @type array $meta_query Optional. An array of meta_query conditions. 713 * See {@link WP_Meta_Query::queries} for description. 714 * @type array|string $value Optional. Array or comma-separated list of group IDs. 715 * Results will be limited to groups within the 716 * list. Default: false. 717 * @type bool $populate_extras Whether to fetch additional information 718 * (such as member count) about groups. Default: true. 719 * @type array|string $exclude Optional. Array or comma-separated list of group IDs. 720 * Results will exclude the listed groups. Default: false. 721 * @type bool $update_meta_cache Whether to pre-fetch groupmeta for 722 * the returned groups. Default: true. 723 * @type bool $show_hidden Whether to include hidden groups in results. Default: false. 709 * @type array $meta_query Optional. An array of meta_query conditions. 710 * See {@link WP_Meta_Query::queries} for description. 711 * @type array|string $value Optional. Array or comma-separated list of group IDs. Results 712 * will be limited to groups within the list. Default: false. 713 * @type bool $populate_extras Whether to fetch additional information 714 * (such as member count) about groups. Default: true. 715 * @type array|string $exclude Optional. Array or comma-separated list of group IDs. 716 * Results will exclude the listed groups. Default: false. 717 * @type bool $update_meta_cache Whether to pre-fetch groupmeta for the returned groups. 718 * Default: true. 719 * @type bool $show_hidden Whether to include hidden groups in results. Default: false. 724 720 * } 725 721 * @return array { … … 754 750 755 751 $defaults = array( 756 'type' => null,757 'orderby' => 'date_created',758 'order' => 'DESC',759 'per_page' => null,760 'page' => null,761 'user_id' => 0,762 'search_terms' => false,752 'type' => null, 753 'orderby' => 'date_created', 754 'order' => 'DESC', 755 'per_page' => null, 756 'page' => null, 757 'user_id' => 0, 758 'search_terms' => false, 763 759 'group_type' => '', 764 760 'group_type__in' => '', 765 761 'group_type__not_in' => '', 766 'meta_query' => false,767 'include' => false,768 'populate_extras' => true,769 'update_meta_cache' => true,770 'exclude' => false,771 'show_hidden' => false,762 'meta_query' => false, 763 'include' => false, 764 'populate_extras' => true, 765 'update_meta_cache' => true, 766 'exclude' => false, 767 'show_hidden' => false, 772 768 ); 773 769 -
trunk/src/bp-groups/classes/class-bp-groups-template.php
r10766 r10767 154 154 155 155 $defaults = array( 156 'page' => 1,157 'per_page' => 20,158 'page_arg' => 'grpage',159 'max' => false,160 'type' => 'active',161 'order' => 'DESC',162 'orderby' => 'date_created',163 'show_hidden' => false,164 'user_id' => 0,165 'slug' => false,166 'include' => false,167 'exclude' => false,168 'search_terms' => '',156 'page' => 1, 157 'per_page' => 20, 158 'page_arg' => 'grpage', 159 'max' => false, 160 'type' => 'active', 161 'order' => 'DESC', 162 'orderby' => 'date_created', 163 'show_hidden' => false, 164 'user_id' => 0, 165 'slug' => false, 166 'include' => false, 167 'exclude' => false, 168 'search_terms' => '', 169 169 'group_type' => '', 170 170 'group_type__in' => '', 171 171 'group_type__not_in' => '', 172 'meta_query' => false,173 'populate_extras' => true,174 'update_meta_cache' => true,172 'meta_query' => false, 173 'populate_extras' => true, 174 'update_meta_cache' => true, 175 175 ); 176 176 … … 214 214 } else { 215 215 $this->groups = groups_get_groups( array( 216 'type' => $type,217 'order' => $order,218 'orderby' => $orderby,219 'per_page' => $this->pag_num,220 'page' => $this->pag_page,221 'user_id' => $user_id,222 'search_terms' => $search_terms,223 'meta_query' => $meta_query,216 'type' => $type, 217 'order' => $order, 218 'orderby' => $orderby, 219 'per_page' => $this->pag_num, 220 'page' => $this->pag_page, 221 'user_id' => $user_id, 222 'search_terms' => $search_terms, 223 'meta_query' => $meta_query, 224 224 'group_type' => $group_type, 225 225 'group_type__in' => $group_type__in, 226 226 'group_type__not_in' => $group_type__not_in, 227 'include' => $include,228 'exclude' => $exclude,229 'populate_extras' => $populate_extras,230 'update_meta_cache' => $update_meta_cache,231 'show_hidden' => $show_hidden227 'include' => $include, 228 'exclude' => $exclude, 229 'populate_extras' => $populate_extras, 230 'update_meta_cache' => $update_meta_cache, 231 'show_hidden' => $show_hidden, 232 232 ) ); 233 233 }
Note: See TracChangeset
for help on using the changeset viewer.