PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.5.0
Forumax – AI Powered Advanced Community Forum Plugin v2.5.0
2.5.1 2.5.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 All 31 releases
← All changes | includes/admin/menu/admin_ui/topics.php +159 -104 1.1.0 → 2.5.0 View file →
@@ -14,142 +14,197 @@
14 14
15 15 $pending_replies = [];
16 16
17 17 $no_reply = 0 == $replies->found_posts ? 'no-reply' : '';
18 - $is_solved = $GLOBALS['bbp_solved_topic']->is_solved( $current_topic_id ) ? ' solved' : ' unsolved';
18 + $is_solved = isset($GLOBALS['forumax_solve_topic']) && $GLOBALS['forumax_solve_topic']->is_solved( $current_topic_id ) ? ' solved' : ' unsolved';
19 19 $is_open = bbp_is_topic_closed( $current_topic_id ) ? ' closed-topics' : ' open-topics';
20 - $is_hidden = bbp_is_topic_spam( $current_topic_id ) ? ' hidden-topics' : '';
20 + $is_hidden = bbp_is_topic_spam( $current_topic_id ) || bbp_is_topic_pending( $current_topic_id ) ? ' hidden-topics' : '';
21 21 $approve_btn = '';
22 22
23 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' ) );
24 + $url = wp_nonce_url( admin_url( 'admin.php?bbpc_approve_topic_id=' . $current_topic_id ), 'bbpc_approve_topic_' . $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>', esc_url( $url ), esc_attr__( 'Approve this Topic', 'forumax' ) );
26 26 }
27 27
28 28 $filter_class = $no_reply . $is_solved . $is_open . $is_hidden;
29 29
30 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">
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 33 <?php
34 34 $edit_link = 'javascript:void( 0 )';
35 35 $target = '_self';
36 + $topic_status = bbp_get_topic_status( $current_topic_id );
36 37 if ( current_user_can( 'editor' ) || current_user_can( 'administrator' ) ) {
37 38 $edit_link = get_edit_post_link( $current_topic_id );
38 39 $target = '_blank';
39 40 }
40 41 ?>
41 - <div class="left-content">
42 - <h4>
43 - <a href="<?php echo esc_attr( $edit_link ); ?>" target="<?php echo esc_attr( $target ); ?>">
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.', 'forumax').'"></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="' . esc_attr( $hidden_status . __( 'Status: Topic', 'forumax' ) ) . '"></span>';
51 + } elseif ( bbp_is_topic_open( $current_topic_id ) ) {
52 + ?> <img src="<?php echo esc_url( FORUMAX_IMG . 'icon/open.svg' ); ?>" alt="<?php esc_attr_e( 'Open icon', 'forumax' ) ?>" title="<?php echo esc_attr__( 'Open Topic', 'forumax' ) ?>"> <?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 + </h4>
63 + <!-- Topic Author -->
64 + <span class="bbpc-author-name">
65 + <?php
66 + esc_html_e( '&nbsp; By: ', 'forumax' );
44 67
45 - <?php the_title(); ?>
46 - </a>
47 - <?php
48 - $allowed_html = [
49 - 'a' => [
50 - 'href' => [],
51 - 'class' => [],
52 - ],
53 - 'span' => [
54 - 'class' => [],
55 - 'title' => [],
56 - ],
57 - ];
58 -
59 - echo wp_kses( $approve_btn, $allowed_html );
68 + echo wp_kses_post(
69 + bbp_get_topic_author_link(
70 + array(
71 + 'post_id' => get_the_ID(),
72 + 'type' => 'name',
73 + )
74 + )
75 + );
76 + ?>
77 + </span>
60 78
61 - while ( $replies->have_posts() ) :
62 - $replies->the_post();
63 - $reply_id = get_the_ID();
79 + <?php
80 + // Pending replies count and Approve button
81 + $allowed_html = [
82 + 'a' => [
83 + 'href' => [],
84 + 'class' => [],
85 + ],
86 + 'span' => [
87 + 'class' => [],
88 + 'title' => [],
89 + ],
90 + ];
64 91
65 - if ( bbp_is_reply_pending( $reply_id ) ) {
66 - $pending_replies[] = $reply_id;
67 - }
92 + echo wp_kses( $approve_btn, $allowed_html );
68 93
69 - endwhile;
70 - wp_reset_postdata();
94 + while ( $replies->have_posts() ) :
95 + $replies->the_post();
96 + $reply_id = get_the_ID();
71 97
98 + if ( bbp_is_reply_pending( $reply_id ) ) {
99 + $pending_replies[] = $reply_id;
100 + }
72 101
73 - $pending_replies_count = count( $pending_replies );
74 - $reply_count = $replies->found_posts - $pending_replies_count;
75 - ?>
76 - <div title="<?php echo esc_attr( $reply_count ) . __( ' Publised replies', 'bbp-core' ); ?>">
77 - <span class="bbpc-reply-count bbpc-published-replies">
78 - <?php echo esc_html( $reply_count ); ?>
79 - </span>
80 - </div>
81 - <?php if ( $pending_replies_count > 0 ) : ?>
82 - <div click-target='<?php echo esc_attr( $current_topic_id ); ?>' title="<?php echo esc_attr( $pending_replies_count ) . __( ' Pending replies', 'bbp-core' ); ?>">
83 - <span class="bbpc-reply-count bbpc-pending-replies">
84 - <?php echo esc_html( $pending_replies_count ); ?>
85 - </span>
86 - </div>
102 + endwhile;
103 + wp_reset_postdata();
104 +
105 + $pending_replies_count = count( $pending_replies );
106 + $reply_count = $replies->found_posts - $pending_replies_count;
107 + ?>
108 + <div
109 + title="<?php echo esc_attr( sprintf(
110 + /* translators: %d: Number of published replies */
111 + __( '%d Published replies', 'forumax' ),
112 + $reply_count
113 + ) ); ?>">
114 +
115 + <span class="bbpc-reply-count bbpc-published-replies">
116 + <?php echo esc_html( $reply_count ); ?>
117 + </span>
118 + </div>
119 +
120 + <?php
121 + if ( $pending_replies_count > 0 ) :
122 + ?>
123 + <div click-target='<?php echo esc_attr( $current_topic_id ); ?>'
124 + title="<?php echo esc_attr( sprintf(
125 + /* translators: %d: Number of Pending replies */
126 + __( '%d Pending replies', 'forumax' ),
127 + $pending_replies_count
128 + ) ); ?>">
129 + <span class="bbpc-reply-count bbpc-pending-replies">
130 + <?php echo esc_html( $pending_replies_count ); ?>
131 + </span>
132 + </div>
133 + <?php
134 + endif;
135 + ?>
136 +
137 + <ul class="actions">
138 + <li>
139 + <a href="<?php echo esc_url( get_permalink( $current_topic_id ) ); ?>" target="_blank" title="<?php esc_attr_e( 'View this reply in new tab', 'forumax' ); ?>">
140 + <span class="dashicons dashicons-external"></span>
141 + </a>
142 + </li>
143 +
144 + <?php if ( current_user_can( 'editor' ) || current_user_can( 'administrator' ) ) : ?>
145 + <li class="delete">
146 + <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', 'forumax' ); ?>">
147 + <span class="dashicons dashicons-trash"></span>
148 + </a>
149 + </li>
87 150 <?php endif; ?>
88 - </h4>
89 - <ul class="actions">
90 - <li>
91 - <a href="<?php echo get_permalink( $current_topic_id ); ?>" target="_blank" title="<?php esc_attr_e( 'View this reply in new tab', 'bbp() - core' ); ?>">
92 - <span class="dashicons dashicons-external"></span>
93 - </a>
94 - </li>
95 -
96 - <?php if ( current_user_can( 'editor' ) || current_user_can( 'administrator' ) ) : ?>
97 - <li class="delete">
98 - <a href="<?php echo admin_url( 'admin.php' ); ?>/menu/Delete_Topic.php?topic_ID=<?php the_ID(); ?>" class="section-delete" title="<?php esc_attr_e( 'Move this topic to the Trash', 'bbp-core' ); ?>">
99 - <span class="dashicons dashicons-trash"></span>
100 - </a>
101 - </li>
102 - <?php endif; ?>
103 - </ul>
104 - </div>
105 - </div>
106 - <!-- Accordion children -->
107 - <div class="easydocs-accordion-body nesting-accordion">
151 + </ul>
152 + </div>
153 + <div class="right-content">
154 + <!-- Topic Refresh Time -->
155 + <span class="progress-text">
156 + <?php bbp_topic_freshness_link() ?>
157 + </span>
158 + <!-- ./Topic Refresh Time -->
159 + </div>
160 + </div>
161 + <!-- Accordion children -->
162 + <div class="easydocs-accordion-body nesting-accordion">
108 163 <?php if ( ! empty( $pending_replies_count ) ) : ?>
109 - <ul class="bbpc-nested-replies" reply-target=<?php echo esc_attr( $current_topic_id ); ?>>
110 - <?php
111 - foreach ( $pending_replies as $p_reply ) {
112 - setup_postdata( $p_reply );
113 - ?>
114 - <li reply-id="<?php the_ID(); ?>" class="bbpc-reply-wrap">
115 - <?php
116 - echo esc_html( wp_trim_words( get_the_content(), 10, '...' ) );
164 + <ul class="bbpc-nested-replies" reply-target=<?php echo esc_attr( $current_topic_id ); ?>>
165 + <?php
166 + foreach ( $pending_replies as $p_reply ) {
167 + setup_postdata( $p_reply );
168 + ?>
169 + <li reply-id="<?php the_ID(); ?>" class="bbpc-reply-wrap">
170 + <?php
171 + echo esc_html( wp_trim_words( get_the_content(), 10, '...' ) );
117 172 echo ' - ';
118 173 the_author();
119 - ?>
120 - <?php
121 - if ( bbp_is_reply_pending( $p_reply ) ) {
122 - $url = admin_url( 'admin.php' ) . '/Approve_Topic.php?bbpc_approve_reply_id=' . $p_reply;
123 - $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' ) );
124 - }
174 + ?>
175 + <?php
176 + if ( bbp_is_reply_pending( $p_reply ) ) {
177 + $url = wp_nonce_url( admin_url( 'admin.php?bbpc_approve_reply_id=' . $p_reply ), 'bbpc_approve_reply_' . $p_reply );
178 + $approve_btn = sprintf( '<a class="bbpc-approve-btn" href="%1$s"><span class="dashicons dashicons-yes" title="%2$s"></span></a>', esc_url( $url ), esc_attr__( 'Approve This Reply', 'forumax' ) );
179 + }
125 180
126 - $allowed_html = [
127 - 'a' => [
128 - 'href' => [],
129 - 'class' => [],
130 - ],
131 - 'span' => [
132 - 'class' => [],
133 - 'title' => [],
134 - ],
181 + $allowed_html = [
182 + 'a' => [
183 + 'href' => [],
184 + 'class' => [],
185 + ],
186 + 'span' => [
187 + 'class' => [],
188 + 'title' => [],
189 + ],
135 190
136 - ];
191 + ];
137 192
138 - echo wp_kses( $approve_btn, $allowed_html );
139 - ?>
140 - </li>
141 - <?php
142 - }
193 + echo wp_kses( $approve_btn, $allowed_html );
194 + ?>
195 + </li>
196 + <?php
197 + }
143 198
144 - wp_reset_postdata();
145 - ?>
146 - </ul>
199 + wp_reset_postdata();
200 + ?>
201 + </ul>
147 202 <?php endif; ?>
148 - </div>
149 - <!-- ./Accordion children ends -->
150 - </li>
151 - <?php
152 - endwhile;
153 - wp_reset_postdata();
203 + </div>
204 + <!-- ./Accordion children ends -->
205 + </li>
206 + <?php
207 + endwhile;
208 + wp_reset_postdata();
154 209 ?>
155 210 </ul>