protected function generate_html($template_type = '') { $post_ids = array(); foreach ($this->search_results['items'] as $item_id => $item_html) { $post_ids[] = $item_id; } $conditions = array(); $conditions[] = "ad_id IN ( " . implode(',', $post_ids) . " ) "; $args = array(); $ads = AWPCP_Ad::get_enabled_ads($args, $conditions); $parity = array('displayaditemseven', 'displayaditemsodd'); if ('ajax' == $template_type) { $layout = buddyboss_global_search_buffer_template_part('loop/' . $this->type, $template_type, false); } else { $layout = get_awpcp_option('displayadlayoutcode'); if (empty($layout)) { $layout = awpcp()->settings->get_option_default_value('displayadlayoutcode'); } } if (!empty($ads)) { foreach ($ads as $i => $listing) { $rendered_listing = awpcp_do_placeholders($listing, $layout, $context); $rendered_listing = str_replace("\$awpcpdisplayaditems", $parity[$i % 2], $rendered_listing); if (function_exists('awpcp_featured_ads')) { $rendered_listing = awpcp_featured_ad_class($listing->ad_id, $rendered_listing); } $rendered_listing = apply_filters('awpcp-render-listing-item', $rendered_listing, $i + 1, $template_type); $result = array('id' => $listing->ad_id, 'type' => $this->type, 'title' => $listing->ad_title, 'html' => $rendered_listing); $this->search_results['items'][$listing->ad_id] = $result; } } }
function buddyboss_global_search_search_page_content($content) { if (!is_admin() && is_search()) { remove_filter('the_content', 'buddyboss_global_search_search_page_content', 9); //setup search resutls and all.. buddyboss_global_search()->search->prepare_search_page(); $content .= buddyboss_global_search_buffer_template_part('results-page', '', false); } return $content; }
protected function generate_html($template_type = '') { $post_ids = array(); foreach ($this->search_results['items'] as $item_id => $item_html) { $post_ids[] = $item_id; } //now we have all the posts //lets do a wp_query and generate html for all posts $qry = new WP_Query(array('post_type' => $this->cpt_name, 'post__in' => $post_ids, 'posts_per_page' => -1)); if ($qry->have_posts()) { while ($qry->have_posts()) { $qry->the_post(); $result = array('id' => get_the_ID(), 'type' => $this->search_type, 'title' => get_the_title(), 'html' => buddyboss_global_search_buffer_template_part('loop/post', $template_type, false)); $this->search_results['items'][get_the_ID()] = $result; } } wp_reset_postdata(); }
protected function generate_html($template_type = '') { $post_ids = array(); foreach ($this->search_results['items'] as $item_id => $item_html) { $post_ids[] = $item_id; } //now we have all the posts //lets do a wp_query and generate html for all posts $qry = new WP_Query(array('post_type' => array('forum', 'topic', 'reply'), 'post__in' => $post_ids, 'posts_per_page' => -1)); if ($qry->have_posts()) { while ($qry->have_posts()) { $qry->the_post(); /** * The following will try to load loop/forum.php, loop/topic.php loop/reply.php(if reply is included). * */ $result_item = array('id' => get_the_ID(), 'type' => $this->type, 'title' => get_the_title(), 'html' => buddyboss_global_search_buffer_template_part('loop/' . get_post_type(), $template_type, false)); $this->search_results['items'][get_the_ID()] = $result_item; } } wp_reset_postdata(); }
protected function generate_html($template_type = '') { $group_ids = array(); foreach ($this->search_results['items'] as $item_id => $item) { $group_ids[] = $item_id; } //now we have all the posts //lets do a groups loop if (bp_has_members(array('include' => $group_ids, 'per_page' => count($group_ids)))) { while (bp_members()) { bp_the_member(); $result_item = array('id' => bp_get_member_user_id(), 'type' => $this->type, 'title' => bp_get_member_name(), 'html' => buddyboss_global_search_buffer_template_part('loop/member', $template_type, false)); $this->search_results['items'][bp_get_member_user_id()] = $result_item; } } }
public function print_results() { $current_tab = $this->search_args['search_subset']; if (isset($this->search_results[$current_tab]['items']) && !empty($this->search_results[$current_tab]['items'])) { foreach ($this->search_results[$current_tab]['items'] as $item_id => $item) { echo $item['html']; } if (function_exists('emi_generate_paging_param')) { $page_slug = untrailingslashit(str_replace(home_url(), '', $this->search_page_url())); emi_generate_paging_param($this->search_results[$current_tab]['total_match_count'], $this->search_args['per_page'], $this->search_args['current_page'], $page_slug); } } else { buddyboss_global_search_buffer_template_part('no-results', $current_tab); } }
function buddyboss_global_search_ajax_search_form_shortcode($atts) { return buddyboss_global_search_buffer_template_part('ajax-search-form', '', false); }
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)); if (is_user_logged_in()) { $args['show_hidden'] = true; } 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' => buddyboss_global_search_buffer_template_part('loop/group', $template_type, false)); $this->search_results['items'][bp_get_group_id()] = $result; } //var_dump( $this->search_results['items'] ); } }
protected function generate_html($template_type = '') { $message_ids = array(); foreach ($this->search_results['items'] as $message_id => $item_html) { $message_ids[] = $message_id; } //$message_ids = implode( ',', $message_ids ); global $wpdb, $bp; $messages_sql = "SELECT m.* " . " FROM {$bp->messages->table_name_messages} m " . " WHERE m.id IN ( " . implode(',', $message_ids) . " ) "; $messages = $wpdb->get_results($messages_sql); $recepients_sql = "SELECT r.thread_id, GROUP_CONCAT( DISTINCT r.user_id ) AS 'recepient_ids' " . " FROM {$bp->messages->table_name_recipients} r JOIN {$bp->messages->table_name_messages} m ON m.thread_id = r.thread_id " . " WHERE m.id IN ( " . implode(',', $message_ids) . " ) " . " GROUP BY r.thread_id "; $threads_recepients = $wpdb->get_results($recepients_sql); foreach ($threads_recepients as $thread_recepients) { foreach ($messages as $message) { if ($message->thread_id == $thread_recepients->thread_id) { $message->recepients = explode(',', $thread_recepients->recepient_ids); } } } foreach ($messages as $message) { global $current_message; $current_message = $message; $result = array('id' => $message->id, 'type' => $this->type, 'title' => $this->search_term, 'html' => buddyboss_global_search_buffer_template_part('loop/message', $template_type, false)); $this->search_results['items'][$message->id] = $result; } }