PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 1.3.2
Forumax – AI Powered Advanced Community Forum Plugin v1.3.2
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 / admin / menu / admin_ui / topics.php

topics.php in Forumax – AI Powered Advanced Community Forum Plugin 1.3.2, at includes/admin/menu/admin_ui/topics.php

171 lines 7.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <ul class="easydocs-accordion">
2 <?php
3 while ( $children->have_posts() ) :
4 $children->the_post();
5 $current_topic_id = get_the_ID();
6
7 $replies = new WP_Query(
8 [
9 'post_parent' => $current_topic_id,
10 'post_type' => bbp_get_reply_post_type(),
11 'post_status' => [ 'publish', 'draft', 'pending' ],
12 ]
13 );
14
15 $pending_replies = [];
16
17 $no_reply = 0 == $replies->found_posts ? 'no-reply' : '';
18 $is_solved = isset($GLOBALS['bbp_solved_topic']) && $GLOBALS['bbp_solved_topic']->is_solved( $current_topic_id ) ? ' solved' : ' unsolved';
19 $is_open = bbp_is_topic_closed( $current_topic_id ) ? ' closed-topics' : ' open-topics';
20 $is_hidden = bbp_is_topic_spam( $current_topic_id ) || bbp_is_topic_pending( $current_topic_id ) ? ' hidden-topics' : '';
21 $approve_btn = '';
22
23 if ( bbp_is_topic_spam( $current_topic_id ) ) {
24 $url = admin_url( 'admin.php' ) . '/Approve_Topic.php?bbpc_approve_topic_id=' . $current_topic_id;
25 $approve_btn = sprintf( '<a class="bbpc-approve-btn" href=%1$s><span class="dashicons dashicons-yes" title="%2$s"></span></a>', $url, __( 'Approve this topic', 'bbp-core' ) );
26 }
27
28 $filter_class = $no_reply . $is_solved . $is_open . $is_hidden;
29
30 ?>
31 <li <?php post_class( 'easydocs-accordion-item accordion ez-section-acc-item mix ' . esc_attr( $filter_class ) ); ?> data-id="<?php echo esc_attr( $current_topic_id ); ?>">
32 <div class="accordion-title ez-section-title">
33 <?php
34 $edit_link = 'javascript:void( 0 )';
35 $target = '_self';
36 $topic_status = bbp_get_topic_status( $current_topic_id );
37 if ( current_user_can( 'editor' ) || current_user_can( 'administrator' ) ) {
38 $edit_link = get_edit_post_link( $current_topic_id );
39 $target = '_blank';
40 }
41 ?>
42 <div class="left-content">
43 <span class="topic-status">
44 <?php
45 // Return the Topic status icon Open, Close, Hidden (spam & pending) and which topic has No reply, is Resolved, is Unresolved.
46 if ( bbp_is_topic_closed( $current_topic_id ) ) {
47 echo '<span class="dashicons dashicons-dismiss" title="'.esc_attr__('Status: Closed.', 'bbp-core').'"></span>';
48 } elseif ( bbp_is_topic_spam( $current_topic_id ) || bbp_is_topic_pending( $current_topic_id ) ) {
49 $hidden_status = bbp_is_topic_spam( $current_topic_id ) ? 'Spam' : 'Pending';
50 echo '<span class="dashicons dashicons-hidden" title="'.$hidden_status.esc_attr__('Status: Topic', 'bbp-core').'"></span>';
51 } elseif ( bbp_is_topic_open( $current_topic_id ) ) {
52 ?> <img src="<?php echo BBPC_IMG ?>icon/open.svg" alt="<?php esc_attr_e( 'Open icon', 'bbp-core' ) ?>" title="<?php echo esc_attr__( 'Open Topic', 'bbp-core' ) ?>"> <?php
53 } else {
54 echo '<span class="dashicons dashicons-info-outline"></span>';
55 }
56 ?>
57 </span>
58 <h4>
59 <a href="<?php echo esc_attr( $edit_link ); ?>" target="<?php echo esc_attr( $target ); ?>">
60 <?php the_title(); ?>
61 </a>
62 <?php
63 $allowed_html = [
64 'a' => [
65 'href' => [],
66 'class' => [],
67 ],
68 'span' => [
69 'class' => [],
70 'title' => [],
71 ],
72 ];
73
74 echo wp_kses( $approve_btn, $allowed_html );
75
76 while ( $replies->have_posts() ) :
77 $replies->the_post();
78 $reply_id = get_the_ID();
79
80 if ( bbp_is_reply_pending( $reply_id ) ) {
81 $pending_replies[] = $reply_id;
82 }
83
84 endwhile;
85 wp_reset_postdata();
86
87
88 $pending_replies_count = count( $pending_replies );
89 $reply_count = $replies->found_posts - $pending_replies_count;
90 ?>
91 <div title="<?php echo esc_attr( $reply_count ) . __( ' Published replies', 'bbp-core' ); ?>">
92 <span class="bbpc-reply-count bbpc-published-replies">
93 <?php echo esc_html( $reply_count ); ?>
94 </span>
95 </div>
96 <?php if ( $pending_replies_count > 0 ) : ?>
97 <div click-target='<?php echo esc_attr( $current_topic_id ); ?>' title="<?php echo esc_attr( $pending_replies_count ) . __( ' Pending replies', 'bbp-core' ); ?>">
98 <span class="bbpc-reply-count bbpc-pending-replies">
99 <?php echo esc_html( $pending_replies_count ); ?>
100 </span>
101 </div>
102 <?php endif; ?>
103 </h4>
104 <ul class="actions">
105 <li>
106 <a href="<?php echo get_permalink( $current_topic_id ); ?>" target="_blank" title="<?php esc_attr_e( 'View this reply in new tab', 'bbp() - core' ); ?>">
107 <span class="dashicons dashicons-external"></span>
108 </a>
109 </li>
110
111 <?php if ( current_user_can( 'editor' ) || current_user_can( 'administrator' ) ) : ?>
112 <li class="delete">
113 <a href="javascript:void(0)" bbp_topic_ID="<?php the_ID(); ?>" class="section-delete" title="<?php esc_attr_e( 'Move this topic to the Trash', 'bbp-core' ); ?>">
114 <span class="dashicons dashicons-trash"></span>
115 </a>
116 </li>
117 <?php endif; ?>
118 </ul>
119 </div>
120 </div>
121 <!-- Accordion children -->
122 <div class="easydocs-accordion-body nesting-accordion">
123 <?php if ( ! empty( $pending_replies_count ) ) : ?>
124 <ul class="bbpc-nested-replies" reply-target=<?php echo esc_attr( $current_topic_id ); ?>>
125 <?php
126 foreach ( $pending_replies as $p_reply ) {
127 setup_postdata( $p_reply );
128 ?>
129 <li reply-id="<?php the_ID(); ?>" class="bbpc-reply-wrap">
130 <?php
131 echo esc_html( wp_trim_words( get_the_content(), 10, '...' ) );
132 echo ' - ';
133 the_author();
134 ?>
135 <?php
136 if ( bbp_is_reply_pending( $p_reply ) ) {
137 $url = admin_url( 'admin.php' ) . '/Approve_Topic.php?bbpc_approve_reply_id=' . $p_reply;
138 $approve_btn = sprintf( '<a class="bbpc-approve-btn" href=%1$s><span class="dashicons dashicons-yes" title="%2$s"></span></a>', $url, __( 'Approve this topic', 'bbp-core' ) );
139 }
140
141 $allowed_html = [
142 'a' => [
143 'href' => [],
144 'class' => [],
145 ],
146 'span' => [
147 'class' => [],
148 'title' => [],
149 ],
150
151 ];
152
153 echo wp_kses( $approve_btn, $allowed_html );
154 ?>
155 </li>
156 <?php
157 }
158
159 wp_reset_postdata();
160 ?>
161 </ul>
162 <?php endif; ?>
163 </div>
164 <!-- ./Accordion children ends -->
165 </li>
166 <?php
167 endwhile;
168 wp_reset_postdata();
169 ?>
170 </ul>
171