PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.5.1
Forumax – AI Powered Advanced Community Forum Plugin v2.5.1
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 +190 -155 1.2.4 → 2.5.1 View file →
@@ -1,155 +1,190 @@
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 ) ? ' 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 - if ( current_user_can( 'editor' ) || current_user_can( 'administrator' ) ) {
37 - $edit_link = get_edit_post_link( $current_topic_id );
38 - $target = '_blank';
39 - }
40 - ?>
41 - <div class="left-content">
42 - <h4>
43 - <a href="<?php echo esc_attr( $edit_link ); ?>" target="<?php echo esc_attr( $target ); ?>">
44 -
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 );
60 -
61 - while ( $replies->have_posts() ) :
62 - $replies->the_post();
63 - $reply_id = get_the_ID();
64 -
65 - if ( bbp_is_reply_pending( $reply_id ) ) {
66 - $pending_replies[] = $reply_id;
67 - }
68 -
69 - endwhile;
70 - wp_reset_postdata();
71 -
72 -
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 ) . __( ' Published 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>
87 - <?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">
108 - <?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, '...' ) );
117 - echo ' - ';
118 - 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 - }
125 -
126 - $allowed_html = [
127 - 'a' => [
128 - 'href' => [],
129 - 'class' => [],
130 - ],
131 - 'span' => [
132 - 'class' => [],
133 - 'title' => [],
134 - ],
135 -
136 - ];
137 -
138 - echo wp_kses( $approve_btn, $allowed_html );
139 - ?>
140 - </li>
141 - <?php
142 - }
143 -
144 - wp_reset_postdata();
145 - ?>
146 - </ul>
147 - <?php endif; ?>
148 - </div>
149 - <!-- ./Accordion children ends -->
150 - </li>
151 - <?php
152 - endwhile;
153 - wp_reset_postdata();
154 - ?>
155 -</ul>
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 + // Batched in admin_ui.php via forumax_admin_reply_stats().
8 + $total_replies = (int) ( $reply_stats['total'][ $current_topic_id ] ?? 0 );
9 + $pending_replies = $reply_stats['pending'][ $current_topic_id ] ?? [];
10 +
11 + $no_reply = 0 === $total_replies ? 'no-reply' : '';
12 + $is_solved = isset($GLOBALS['forumax_solve_topic']) && $GLOBALS['forumax_solve_topic']->is_solved( $current_topic_id ) ? ' solved' : ' unsolved';
13 + $is_open = bbp_is_topic_closed( $current_topic_id ) ? ' closed-topics' : ' open-topics';
14 + $is_hidden = bbp_is_topic_spam( $current_topic_id ) || bbp_is_topic_pending( $current_topic_id ) ? ' hidden-topics' : '';
15 + $approve_btn = '';
16 +
17 + if ( bbp_is_topic_spam( $current_topic_id ) ) {
18 + $url = wp_nonce_url( admin_url( 'admin.php?bbpc_approve_topic_id=' . $current_topic_id ), 'bbpc_approve_topic_' . $current_topic_id );
19 + $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' ) );
20 + }
21 +
22 + $filter_class = $no_reply . $is_solved . $is_open . $is_hidden;
23 +
24 + ?>
25 + <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 ); ?>">
26 + <div class="accordion-title ez-section-title">
27 + <?php
28 + $edit_link = 'javascript:void( 0 )';
29 + $target = '_self';
30 + $topic_status = bbp_get_topic_status( $current_topic_id );
31 + if ( current_user_can( 'editor' ) || current_user_can( 'administrator' ) ) {
32 + $edit_link = get_edit_post_link( $current_topic_id );
33 + $target = '_blank';
34 + }
35 + ?>
36 + <div class="left-content">
37 + <span class="topic-status">
38 + <?php
39 + // Return the Topic status icon Open, Close, Hidden (spam & pending) and which topic has No reply, is Resolved, is Unresolved.
40 + if ( bbp_is_topic_closed( $current_topic_id ) ) {
41 + echo '<span class="dashicons dashicons-dismiss" title="'.esc_attr__('Status: Closed.', 'forumax').'"></span>';
42 + } elseif ( bbp_is_topic_spam( $current_topic_id ) || bbp_is_topic_pending( $current_topic_id ) ) {
43 + $hidden_status = bbp_is_topic_spam( $current_topic_id ) ? 'Spam ' : 'Pending ';
44 + echo '<span class="dashicons dashicons-hidden" title="' . esc_attr( $hidden_status . __( 'Status: Topic', 'forumax' ) ) . '"></span>';
45 + } elseif ( bbp_is_topic_open( $current_topic_id ) ) {
46 + ?> <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
47 + } else {
48 + echo '<span class="dashicons dashicons-info-outline"></span>';
49 + }
50 + ?>
51 + </span>
52 + <h4>
53 + <a href="<?php echo esc_attr( $edit_link ); ?>" target="<?php echo esc_attr( $target ); ?>">
54 + <?php echo esc_html( get_the_title( $current_topic_id ) ); ?>
55 + </a>
56 + </h4>
57 + <!-- Topic Author -->
58 + <span class="bbpc-author-name">
59 + <?php
60 + esc_html_e( '&nbsp; By: ', 'forumax' );
61 +
62 + echo wp_kses_post(
63 + bbp_get_topic_author_link(
64 + array(
65 + 'post_id' => $current_topic_id,
66 + 'type' => 'name',
67 + )
68 + )
69 + );
70 + ?>
71 + </span>
72 +
73 + <?php
74 + // Pending replies count and Approve button
75 + $allowed_html = [
76 + 'a' => [
77 + 'href' => [],
78 + 'class' => [],
79 + ],
80 + 'span' => [
81 + 'class' => [],
82 + 'title' => [],
83 + ],
84 + ];
85 +
86 + echo wp_kses( $approve_btn, $allowed_html );
87 +
88 + $pending_replies_count = count( $pending_replies );
89 + $reply_count = $total_replies - $pending_replies_count;
90 + ?>
91 + <div
92 + title="<?php echo esc_attr( sprintf(
93 + /* translators: %d: Number of published replies */
94 + __( '%d Published replies', 'forumax' ),
95 + $reply_count
96 + ) ); ?>">
97 +
98 + <span class="bbpc-reply-count bbpc-published-replies">
99 + <?php echo esc_html( $reply_count ); ?>
100 + </span>
101 + </div>
102 +
103 + <?php
104 + if ( $pending_replies_count > 0 ) :
105 + ?>
106 + <div click-target='<?php echo esc_attr( $current_topic_id ); ?>'
107 + title="<?php echo esc_attr( sprintf(
108 + /* translators: %d: Number of Pending replies */
109 + __( '%d Pending replies', 'forumax' ),
110 + $pending_replies_count
111 + ) ); ?>">
112 + <span class="bbpc-reply-count bbpc-pending-replies">
113 + <?php echo esc_html( $pending_replies_count ); ?>
114 + </span>
115 + </div>
116 + <?php
117 + endif;
118 + ?>
119 +
120 + <ul class="actions">
121 + <li>
122 + <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' ); ?>">
123 + <span class="dashicons dashicons-external"></span>
124 + </a>
125 + </li>
126 +
127 + <?php if ( current_user_can( 'editor' ) || current_user_can( 'administrator' ) ) : ?>
128 + <li class="delete">
129 + <a href="javascript:void(0)" bbp_topic_ID="<?php echo esc_attr( $current_topic_id ); ?>" class="section-delete" title="<?php esc_attr_e( 'Move this topic to the Trash', 'forumax' ); ?>">
130 + <span class="dashicons dashicons-trash"></span>
131 + </a>
132 + </li>
133 + <?php endif; ?>
134 + </ul>
135 + </div>
136 + <div class="right-content">
137 + <!-- Topic Refresh Time -->
138 + <span class="progress-text">
139 + <?php bbp_topic_freshness_link( $current_topic_id ); ?>
140 + </span>
141 + <!-- ./Topic Refresh Time -->
142 + </div>
143 + </div>
144 + <!-- Accordion children -->
145 + <div class="easydocs-accordion-body nesting-accordion">
146 + <?php if ( ! empty( $pending_replies_count ) ) : ?>
147 + <ul class="bbpc-nested-replies" reply-target=<?php echo esc_attr( $current_topic_id ); ?>>
148 + <?php
149 + foreach ( $pending_replies as $p_reply ) {
150 + ?>
151 + <li reply-id="<?php echo esc_attr( $p_reply ); ?>" class="bbpc-reply-wrap">
152 + <?php
153 + echo esc_html( wp_trim_words( get_post_field( 'post_content', $p_reply ), 10, '...' ) );
154 + echo ' - ';
155 + echo esc_html( bbp_get_reply_author_display_name( $p_reply ) );
156 + ?>
157 + <?php
158 + if ( bbp_is_reply_pending( $p_reply ) ) {
159 + $url = wp_nonce_url( admin_url( 'admin.php?bbpc_approve_reply_id=' . $p_reply ), 'bbpc_approve_reply_' . $p_reply );
160 + $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' ) );
161 + }
162 +
163 + $allowed_html = [
164 + 'a' => [
165 + 'href' => [],
166 + 'class' => [],
167 + ],
168 + 'span' => [
169 + 'class' => [],
170 + 'title' => [],
171 + ],
172 +
173 + ];
174 +
175 + echo wp_kses( $approve_btn, $allowed_html );
176 + ?>
177 + </li>
178 + <?php
179 + }
180 + ?>
181 + </ul>
182 + <?php endif; ?>
183 + </div>
184 + <!-- ./Accordion children ends -->
185 + </li>
186 + <?php
187 + endwhile;
188 + wp_reset_postdata();
189 + ?>
190 +</ul>