PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.1.0
Forumax – AI Powered Advanced Community Forum Plugin v2.1.0
2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 2.0.0 2.1.0 All 29 releases
bbp-core / includes / ajax_actions.php

ajax_actions.php in Forumax – AI Powered Advanced Community Forum Plugin 2.1.0, at includes/ajax_actions.php

622 lines 20.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Ajax actions for Forumax
4 *
5 * @package Forumax
6 */
7
8 defined( 'ABSPATH' ) || exit;
9
10 defined( 'ABSPATH' ) || exit;
11
12 /**
13 * All Search results
14 */
15 add_action( 'wp_ajax_forumax_search_data_fetch', 'forumax_search_data_fetch' );
16 add_action( 'wp_ajax_nopriv_forumax_search_data_fetch', 'forumax_search_data_fetch' );
17
18 /**
19 * Fetch search data.
20 */
21 function forumax_search_data_fetch() {
22
23 // Check nonce
24 check_ajax_referer( 'forumax-nonce', 'nonce' );
25
26 $opt = get_option( 'bbpc_opt' );
27 $is_ajax_search_tab = $opt['is_ajax_search_tab'] ?? '';
28
29 // Sanitize keyword
30 $keyword = isset( $_POST['keyword'] ) ? sanitize_text_field( $_POST['keyword'] ) : '';
31
32 if ( class_exists( 'bbPress' ) ) {
33 // All results query
34 $all_results = new WP_Query( [
35 'post_type' => [ 'forum', 'topic' ],
36 's' => $keyword,
37 ] );
38 $all_results_count = $all_results->found_posts;
39 if ( $all_results_count > 0 ) {
40 $all_nsoresult = 'data-result=';
41 } else {
42 $all_nsoresult = 'data-noresult=';
43 }
44
45 // Forum query
46 $forum_query = new WP_Query( [
47 'post_type' => [ 'forum', 'topic' ],
48 's' => $keyword,
49 ] );
50 $forum_count = $forum_query->found_posts;
51 if ( $forum_count > 0 ) {
52 $forum_nsoresult = 'data-result=';
53 } else {
54 $forum_nsoresult = 'data-noresult=';
55 }
56
57 ?>
58 <div class="tab-item active all-active" <?php echo esc_attr( $all_nsoresult . 'No-Results-Found' ); ?>></div>
59 <?php
60 if ( class_exists( 'bbPress' ) ) : ?>
61 <div id="search-forum" <?php echo esc_attr( $forum_nsoresult . 'No-Results-Found' ); ?> class="tab-item" ></div>
62 <?php
63 endif;
64 }
65
66 echo '<div class="bbpc-search-results-wrapper">';
67
68 // Forums query
69 if ( class_exists( 'bbPress' ) ) :
70
71 echo '<div class="search-results-tab forum show" id="search-forum-results">';
72
73 $forum = new WP_Query( [
74 'post_type' => 'forum',
75 's' => $keyword,
76 'posts_per_page' => 5,
77 ] );
78
79 if ( $forum->have_posts() ) :
80 echo '<h2 class="bbpc-search-title">' . esc_html__( 'Forums', 'forumax' ) . '</h2>';
81 while ( $forum->have_posts() ) : $forum->the_post();
82 ?>
83 <div class="search-result-item forum" onclick="document.location='<?php echo esc_url( get_the_permalink( get_the_ID() ) ); ?>'">
84 <a href="<?php echo esc_url( get_the_permalink( get_the_ID() ) ); ?>">
85 <?php the_title(); ?>
86 </a>
87 </div>
88 <?php
89 endwhile;
90 wp_reset_postdata();
91 endif;
92
93 $topics = new WP_Query( [
94 'post_type' => 'topic',
95 's' => $keyword,
96 'posts_per_page' => 5,
97 ] );
98
99 if ( $topics->have_posts() ) :
100 echo '<h2 class="bbpc-search-title">' . esc_html__( 'Topics', 'forumax' ) . '</h2>';
101 while ( $topics->have_posts() ) : $topics->the_post();
102 ?>
103 <div class="search-result-item forum" onclick="document.location='<?php echo esc_url( get_the_permalink( get_the_ID() ) ); ?>'">
104 <a href="<?php echo esc_url( get_the_permalink( get_the_ID() ) ); ?>">
105 <?php the_title(); ?>
106 </a>
107 </div>
108 <?php
109 endwhile;
110 wp_reset_postdata();
111 endif;
112 echo '</div>';
113 endif;
114
115 echo '<h5 class="not-found-text">' . esc_html__( 'Not Found Result!', 'forumax' ) . '</h5>';
116 echo '</div>';
117 wp_die();
118 }
119
120 /**
121 * Forum Search results
122 */
123 add_action( 'wp_ajax_forumax_search_data_forum', 'forumax_search_data_forum' );
124 add_action( 'wp_ajax_nopriv_forumax_search_data_forum', 'forumax_search_data_forum' );
125
126 /**
127 * Search data forum.
128 */
129 function forumax_search_data_forum() {
130
131 // Check nonce
132 check_ajax_referer( 'forumax-nonce', 'nonce' );
133
134 // Sanitize keyword
135 $keyword = isset( $_POST['keyword'] ) ? sanitize_text_field( $_POST['keyword'] ) : '';
136
137 // Forums query
138 if ( class_exists( 'bbPress' ) ) :
139
140 echo '<div class="search-results-tab show" id="search-forum-results">';
141
142 $forum = new WP_Query( [
143 'post_type' => 'forum',
144 's' => $keyword,
145 'posts_per_page' => 5,
146 ] );
147
148 if ( $forum->have_posts() ) :
149 echo '<h2 class="bbpc-search-title">' . esc_html__( 'Forums', 'forumax' ) . '</h2>';
150 while ( $forum->have_posts() ) : $forum->the_post();
151 ?>
152 <div class="search-result-item forum" onclick="document.location='<?php echo esc_url( get_the_permalink( get_the_ID() ) ); ?>'">
153 <a href="<?php echo esc_url( get_the_permalink( get_the_ID() ) ); ?>">
154 <?php the_title(); ?>
155 </a>
156 </div>
157 <?php
158 endwhile;
159 wp_reset_postdata();
160 endif;
161
162 $topics = new WP_Query( [
163 'post_type' => 'topic',
164 's' => $keyword,
165 'posts_per_page' => 5,
166 ] );
167
168 if ( $topics->have_posts() ) :
169 echo '<h2 class="bbpc-search-title">' . esc_html__( 'Topics', 'forumax' ) . '</h2>';
170 while ( $topics->have_posts() ) : $topics->the_post();
171 ?>
172 <div class="search-result-item forum" onclick="document.location='<?php echo esc_url( get_the_permalink( get_the_ID() ) ); ?>'">
173 <a href="<?php echo esc_url( get_the_permalink( get_the_ID() ) ); ?>">
174 <?php the_title(); ?>
175 </a>
176 </div>
177 <?php
178 endwhile;
179 wp_reset_postdata();
180 endif;
181 echo '</div>';
182 endif;
183 wp_die();
184 }
185
186 /**
187 * AJAX handler to fetch forums for Gutenberg block editor
188 * Used by the Single Forum block to populate the forum selector dropdown
189 */
190 add_action( 'wp_ajax_bbpc_get_forums', 'forumax_get_forums_ajax' );
191
192 /**
193 * Get forums ajax.
194 */
195 function forumax_get_forums_ajax() {
196 // Verify nonce for security
197 check_ajax_referer( 'forumax-nonce', 'nonce' );
198
199 if ( ! current_user_can( 'edit_posts' ) ) {
200 wp_send_json_error( 'Unauthorized' );
201 }
202
203 // Get all forums
204 $forums = new \WP_Query( [
205 'post_type' => 'forum',
206 'posts_per_page' => -1,
207 'orderby' => 'title',
208 'order' => 'ASC',
209 ] );
210
211 $forum_list = [];
212
213 if ( $forums->have_posts() ) {
214 while ( $forums->have_posts() ) {
215 $forums->the_post();
216 $forum_list[] = [
217 'id' => get_the_ID(),
218 'title' => get_the_title(),
219 ];
220 }
221 wp_reset_postdata();
222 }
223
224 wp_send_json_success( $forum_list );
225 }
226
227
228 /**
229 * Loading Post
230 */
231 add_action( 'wp_ajax_forumax_loading_post', 'forumax_loading_post' );
232 add_action( 'wp_ajax_nopriv_forumax_loading_post', 'forumax_loading_post' );
233
234 /**
235 * Loading forum posts
236 *
237 * @return void
238 */
239 function forumax_loading_post() {
240 // Check nonce
241 if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'forumax-nonce' ) ) {
242 wp_die( '-1' );
243 }
244
245 $type = isset( $_POST['type'] ) ? sanitize_text_field( wp_unslash( $_POST['type'] ) ) : '';
246 $post_in = isset( $_POST['a_t_id'] ) ? sanitize_text_field( wp_unslash( $_POST['a_t_id'] ) ) : '';
247 $count = isset( $_POST['count'] ) ? sanitize_text_field( wp_unslash( $_POST['count'] ) ) : '';
248 $parent = isset( $_POST['parent'] ) ? sanitize_text_field( wp_unslash( $_POST['parent'] ) ) : '';
249
250 $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
251 $q = [
252 'post_type' => 'topic',
253 'post_parent' => $parent,
254 'order' => 'DESC',
255 'orderby' => 'post_date',
256 'post_status' => 'publish',
257 'posts_per_page' => get_option( '_bbp_topics_per_page', 10 ),
258 'ignore_sticky_posts' => 1,
259 ];
260
261 if ( 'author' === $type ) {
262 $auth_ids = [
263 'author' => $post_in,
264 ];
265 $q = array_merge( $q, $auth_ids );
266 } elseif ( 'tag' === $type ) {
267 $tax_query[] = [
268 'taxonomy' => 'topic-tag',
269 'field' => 'term_id',
270 'terms' => $post_in,
271 ];
272 }
273
274 $tax_query[] = [
275 'taxonomy' => 'post_format',
276 'field' => 'slug',
277 'terms' => [ 'post-format-quote', 'post-format-link' ],
278 'operator' => 'NOT IN',
279 ];
280
281 if ( ! empty( $tax_query ) ) {
282 $tax_query = array_merge( [ 'relation' => 'AND' ], $tax_query );
283 $q = array_merge( $q, [ 'tax_query' => $tax_query ] );
284 }
285
286 $query = new WP_Query( $q );
287
288 if ( $query->have_posts() ) :
289 echo '<div class="community-posts-wrapper bb-radius">';
290 while ( $query->have_posts() ) : $query->the_post();
291 global $post;
292 $author_id = $post->post_author;
293 $parent_post_id = $parent;
294 $favoriters = get_post_meta( get_the_ID(), '_bbp_favorite', true );
295 $favorite_count = ! empty( $favoriters ) ? $favoriters[0] : '0';
296 $get_reply = get_post_meta( get_the_ID(), '_bbp_reply_count', true );
297 $_reply_count = isset( $get_reply ) && ! empty( $get_reply ) ? $get_reply : 0;
298 ?>
299 <div class="community-post style-two <?php the_author_meta( 'user_nicename', $author_id ); ?>">
300 <div class="post-content">
301 <div class="author-avatar">
302 <?php
303 echo bbp_get_topic_author_link(
304 [
305 'post_id' => get_the_ID(),
306 'type' => 'avatar',
307 'size' => 40,
308 ]
309 );
310 ?>
311 </div>
312 <div class="entry-content">
313 <?php the_title( sprintf( '<a href="%s" rel="bookmark"> <h3 class="post-title">', esc_url( get_permalink() ) ), '</h3></a>' ); ?>
314 <ul class="meta">
315 <li>
316 <?php echo get_the_post_thumbnail( bbp_get_topic_forum_id(), [ 40, 40 ] ); ?>
317 <a href="<?php echo get_permalink( bbp_get_topic_forum_id() ); ?>">
318 <?php echo get_the_title( bbp_get_topic_forum_id() ); ?>
319 </a>
320 </li>
321 <li><i class="icon_clock_alt"></i> <?php bbp_topic_post_date( get_the_ID() ); ?> </li>
322 </ul>
323 </div>
324 </div>
325 <div class="post-meta-wrapper">
326 <ul class="post-meta-info">
327 <li><a href="#"><i class="icon_chat_alt"></i><?php echo esc_html( $_reply_count ); ?></a></li>
328 <li><a href="#"><i class="icon_star"></i><?php echo esc_html( $favorite_count ); ?></a></li>
329 </ul>
330 </div>
331 </div>
332 <?php
333 endwhile;
334 wp_reset_postdata();
335
336 echo '</div>';
337 else :
338 echo '<div class="community-post-error bug">';
339 echo '<div class="error-content">';
340 echo '<svg height="40" class="forumax-error error-icon" viewBox="0 0 24 24" version="1.1" width="40" aria-hidden="true"><path d="M12 7a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0112 7zm1 9a1 1 0 11-2 0 1 1 0 012 0z"></path><path fill-rule="evenodd" d="M12 1C5.925 1 1 5.925 1 12s4.925 11 11 11 11-4.925 11-11S18.075 1 12 1zM2.5 12a9.5 9.5 0 1119 0 9.5 9.5 0 01-19 0z"></path></svg>';
341 echo '<h3 class="error">' . esc_html__( 'Oops! No results matched your search.', 'forumax' ) . '</h3>';
342 echo '<p class="error">' . esc_html__( 'You could search again.', 'forumax' ) . '</p>';
343 echo '</div>';
344 echo '</div>';
345 endif;
346
347 wp_die();
348 }
349
350 /**
351 * Filter posts by status (open/closed)
352 *
353 * @return void
354 */
355 add_action( 'wp_ajax_forumax_open_post', 'forumax_open_post' );
356 add_action( 'wp_ajax_nopriv_forumax_open_post', 'forumax_open_post' );
357
358 /**
359 * Open post.
360 */
361 function forumax_open_post() {
362
363 // Check nonce
364 if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'forumax-nonce' ) ) {
365 wp_die( '-1' );
366 }
367
368 $is_queried_obj = is_singular( 'forum' ) ? get_queried_object_id() : false;
369 $type = isset( $_POST['type'] ) ? sanitize_text_field( wp_unslash( $_POST['type'] ) ) : '';
370 $post_in = isset( $_POST['a_t_id'] ) ? sanitize_text_field( wp_unslash( $_POST['a_t_id'] ) ) : '';
371 $count = isset( $_POST['count'] ) ? sanitize_text_field( wp_unslash( $_POST['count'] ) ) : '';
372 $parent = isset( $_POST['parent'] ) ? sanitize_text_field( wp_unslash( $_POST['parent'] ) ) : '';
373 $userid = isset( $_POST['userid'] ) ? sanitize_text_field( wp_unslash( $_POST['userid'] ) ) : '';
374
375 $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
376 $q = [
377 'post_type' => 'topic',
378 'post_parent' => $parent,
379 'order' => 'DESC',
380 'orderby' => 'post_date',
381 'posts_per_page' => get_option( '_bbp_topics_per_page', 10 ),
382 'ignore_sticky_posts' => 1,
383 'author' => $userid,
384 ];
385
386 if ( 'open' === $type ) {
387 $status = [
388 'post_status' => 'publish',
389 ];
390 $q = array_merge( $q, $status );
391 } elseif ( 'closed' === $type ) {
392 $status = [
393 'post_status' => 'closed',
394 ];
395 $q = array_merge( $q, $status );
396 }
397
398 $tax_query[] = [
399 'taxonomy' => 'post_format',
400 'field' => 'slug',
401 'terms' => [ 'post-format-quote', 'post-format-link' ],
402 'operator' => 'NOT IN',
403 ];
404
405 if ( ! empty( $tax_query ) ) {
406 $tax_query = array_merge( [ 'relation' => 'AND' ], $tax_query );
407 $q = array_merge( $q, [ 'tax_query' => $tax_query ] );
408 }
409
410 $query = new WP_Query( $q );
411 if ( $query->have_posts() ) :
412 echo '<div class="community-posts-wrapper bb-radius">';
413 while ( $query->have_posts() ) : $query->the_post();
414 global $post;
415 $author_id = $post->post_author;
416 //$parent_post_id = get_post_meta( get_the_ID(), '_bbp_topic_id', true );
417 $parent_post_id = $parent;
418 $favoriters = get_post_meta( get_the_ID(), '_bbp_favorite', true );
419 $favorite_count = ! empty( $favoriters ) ? $favoriters[0] : '0';
420 $get_reply = get_post_meta( get_the_ID(), '_bbp_reply_count', true );
421 $_reply_count = isset( $get_reply ) && ! empty( $get_reply ) ? $get_reply : 0;
422 ?>
423
424 <div class="community-post style-two <?php the_author_meta( 'user_nicename', $author_id ); ?>">
425 <div class="post-content">
426 <div class="author-avatar">
427 <?php
428 echo bbp_get_topic_author_link(
429 [
430 'post_id' => get_the_ID(),
431 'type' => 'avatar',
432 'size' => 40,
433 ]
434 );
435 ?>
436 </div>
437 <div class="entry-content">
438 <?php the_title( sprintf( '<a href="%s" rel="bookmark"> <h3 class="post-title">', get_permalink() ), '</h3></a>' ); ?>
439 <ul class="meta">
440 <li>
441 <?php echo get_the_post_thumbnail( bbp_get_topic_forum_id(), [ 40, 40 ] ); ?>
442 <a href="<?php echo get_permalink( bbp_get_topic_forum_id() ); ?>">
443 <?php echo get_the_title( bbp_get_topic_forum_id() ); ?>
444 </a>
445 </li>
446 <li><i class="icon_clock_alt"></i> <?php bbp_topic_post_date( get_the_ID() ); ?> </li>
447 </ul>
448 </div>
449 </div>
450 <div class="post-meta-wrapper">
451 <ul class="post-meta-info">
452 <li><a href="#"><i class="icon_chat_alt"></i><?php echo esc_html( $_reply_count ); ?></a></li>
453 <li><a href="#"><i class="icon_star"></i><?php echo esc_html( $favorite_count ); ?></a></li>
454 </ul>
455 </div>
456 </div>
457 <?php
458 endwhile;
459 wp_reset_postdata();
460
461 echo '</div>';
462 else :
463 echo '<div class="community-post-error bug">';
464 echo '<div class="error-content">';
465 echo '<svg height="40" class="forumax-error error-icon" viewBox="0 0 24 24" version="1.1" width="40" aria-hidden="true"><path d="M12 7a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0112 7zm1 9a1 1 0 11-2 0 1 1 0 012 0z"></path><path fill-rule="evenodd" d="M12 1C5.925 1 1 5.925 1 12s4.925 11 11 11 11-4.925 11-11S18.075 1 12 1zM2.5 12a9.5 9.5 0 1119 0 9.5 9.5 0 01-19 0z"></path></svg>';
466 echo '<h3 class="error">' . esc_html__( 'Oops! No results matched your search.', 'forumax' ) . '</h3>';
467 echo '<p class="error">' . esc_html__( 'You could search again.', 'forumax' ) . '</p>';
468 echo '</div>';
469 echo '</div>';
470 endif;
471 wp_die();
472 }
473
474 /**
475 * Sort posts
476 *
477 * @return void
478 */
479 add_action( 'wp_ajax_forumax_loading_sort_post', 'forumax_loading_sort_post' );
480 add_action( 'wp_ajax_nopriv_forumax_loading_sort_post', 'forumax_loading_sort_post' );
481
482 /**
483 * Loading sort post.
484 */
485 function forumax_loading_sort_post() {
486
487 // Check nonce
488 if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'forumax-nonce' ) ) {
489 wp_die( '-1' );
490 }
491
492 $sort = isset( $_POST['sort'] ) ? sanitize_text_field( wp_unslash( $_POST['sort'] ) ) : '';
493 $parent = isset( $_POST['parent'] ) ? sanitize_text_field( wp_unslash( $_POST['parent'] ) ) : '';
494
495 $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
496 $q = [
497 'post_type' => 'topic',
498 'post_parent' => $parent,
499 'post_status' => 'publish',
500 'posts_per_page' => get_option( '_bbp_topics_per_page', 10 ),
501 'ignore_sticky_posts' => 1,
502 ];
503
504 if ( 'newest_posts' === $sort ) {
505 $newest_posts = [
506 'order' => 'DESC',
507 ];
508 $q = array_merge( $q, $newest_posts );
509 } elseif ( 'oldest_posts' === $sort ) {
510 $oldest_posts = [
511 'order' => 'ASC',
512 ];
513 $q = array_merge( $q, $oldest_posts );
514 } elseif ( 'comment_count' === $sort ) {
515 $comment_count = [
516 'meta_key' => '_bbp_reply_count',
517 'orderby' => 'meta_value_num',
518 'order' => 'DESC',
519 ];
520 $q = array_merge( $q, $comment_count );
521 } elseif ( 'comment_date' === $sort ) {
522 $comment_count = [
523 'meta_key' => '_bbp_reply_count',
524 'meta_type' => 'NUMERIC',
525 'orderby' => 'meta_value_num',
526 'order' => 'ASC',
527 ];
528 $q = array_merge( $q, $comment_count );
529 } elseif ( 'recent_updated_post' === $sort ) {
530 $post_date = [
531 'orderby' => 'post_modified',
532 'order' => 'DESC',
533 ];
534 $q = array_merge( $q, $post_date );
535 } elseif ( 'last_recent_updated_post' === $sort ) {
536 $post_modified = [
537 'orderby' => 'post_modified',
538 'order' => 'ASC',
539 ];
540 $q = array_merge( $q, $post_modified );
541 }
542
543 $tax_query[] = [
544 'taxonomy' => 'post_format',
545 'field' => 'slug',
546 'terms' => [ 'post-format-quote', 'post-format-link' ],
547 'operator' => 'NOT IN',
548 ];
549
550 if ( ! empty( $tax_query ) ) {
551 $tax_query = array_merge( [ 'relation' => 'AND' ], $tax_query );
552 $q = array_merge( $q, [ 'tax_query' => $tax_query ] );
553 }
554
555 $query = new WP_Query( $q );
556 if ( $query->have_posts() ) :
557 echo '<div class="community-posts-wrapper bb-radius">';
558 while ( $query->have_posts() ) : $query->the_post();
559 global $post;
560
561 $author_id = $post->post_author;
562 $parent_post_id = $parent;
563 $favoriters = get_post_meta( get_the_ID(), '_bbp_favorite', true );
564 $favorite_count = ! empty( $favoriters ) ? $favoriters[0] : '0';
565 $get_reply = get_post_meta( get_the_ID(), '_bbp_reply_count', true );
566 $_reply_count = isset( $get_reply ) && ! empty( $get_reply ) ? $get_reply : 0;
567 ?>
568 <div class="community-post style-two <?php the_author_meta( 'user_nicename', $author_id ); ?>">
569 <div class="post-content">
570 <div class="author-avatar">
571 <?php
572 echo bbp_get_topic_author_link(
573 [
574 'post_id' => get_the_ID(),
575 'type' => 'avatar',
576 'size' => 40,
577 ]
578 );
579 ?>
580 </div>
581 <div class="entry-content">
582 <?php the_title( sprintf( '<a href="%s" rel="bookmark"> <h3 class="post-title">', esc_url( get_permalink() ) ), '</h3></a>' ); ?>
583 <ul class="meta">
584 <li>
585 <?php
586 if ( get_the_post_thumbnail_url( $parent_post_id ) ) :
587 ?>
588 <img src="<?php echo get_the_post_thumbnail_url( $parent_post_id ); ?>"
589 alt="<?php echo get_the_title( $parent_post_id ); ?>">
590 <?php
591 endif;
592 ?>
593 <a href="<?php echo get_permalink( $parent_post_id ); ?>"> <?php echo get_the_title( $parent_post_id ); ?> </a>
594 </li>
595 <li><i class="icon_clock_alt"></i> <?php bbp_topic_post_date( get_the_ID() ); ?> </li>
596 </ul>
597 </div>
598 </div>
599 <div class="post-meta-wrapper">
600 <ul class="post-meta-info">
601 <li><a href="#"><i class="icon_chat_alt"></i><?php echo esc_html( $_reply_count ); ?></a></li>
602 <li><a href="#"><i class="icon_star"></i><?php echo esc_html( $favorite_count ); ?></a></li>
603 </ul>
604 </div>
605 </div>
606 <?php endwhile;
607 wp_reset_postdata();
608
609 echo '</div>';
610 else :
611 echo '<div class="community-post-error bug">';
612 echo '<div class="error-content">';
613 echo '<svg height="40" class="forumax-error error-icon" viewBox="0 0 24 24" version="1.1" width="40" aria-hidden="true"><path d="M12 7a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0112 7zm1 9a1 1 0 11-2 0 1 1 0 012 0z"></path><path fill-rule="evenodd" d="M12 1C5.925 1 1 5.925 1 12s4.925 11 11 11 11-4.925 11-11S18.075 1 12 1zM2.5 12a9.5 9.5 0 1119 0 9.5 9.5 0 01-19 0z"></path></svg>';
614 echo '<h3 class="error">' . esc_html__( 'Oops! No results matched your search.', 'forumax' ) . '</h3>';
615 echo '<p class="error">' . esc_html__( 'You could search again.', 'forumax' ) . '</p>';
616 echo '</div>';
617 echo '</div>';
618 endif;
619
620 wp_die();
621 }
622