Bp_Search_Groups::generate_html( $template_type = '' )

Description

Source

File: bp-search/classes/class-bp-search-groups.php

155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
protected function generate_html( $template_type='' ){
    $group_ids = array();
    foreach( $this->search_results['items'] as $item_id=>$item_html ){
        $group_ids[] = $item_id;
    }
 
    //now we have all the posts
    //lets do a groups loop
    $args = array( 'include'=>$group_ids, 'per_page'=>count($group_ids), 'search_terms' => false );
    if( is_user_logged_in() ){
        $args['show_hidden'] = true;
    }
 
    if (function_exists('bp_bpla') ) {
        $args['search_terms'] = ' ';
    }
 
    do_action( 'bp_before_search_groups_html' );
 
    if( bp_has_groups( $args ) ){
        while ( bp_groups() ){
            bp_the_group();
 
            $result = array(
                'id'    => bp_get_group_id(),
                'type'  => $this->type,
                'title' => bp_get_group_name(),
                'html'  => bp_search_buffer_template_part( 'loop/group', $template_type, false ),
            );
 
            $this->search_results['items'][bp_get_group_id()] = $result;
        }
    }
 
    do_action( 'bp_after_search_groups_html' );
}

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.