Bp_Search_Groups::generate_html( $template_type = '' )

Description

Source

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

		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.