PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.5.0
Forumax – AI Powered Advanced Community Forum Plugin v2.5.0
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 2.0.0 All 30 releases
← All changes | includes/admin/menu/admin_ui.php +93 -78 1.1.0 → 2.5.0 View file →
@@ -1,13 +1,12 @@
1 1 <?php
2 2 if ( ! class_exists( 'bbPress' ) ) {
3 3 return;
4 4 }
5 +
5 6 $parent_forums = [];
6 7 $fcount = wp_count_posts( bbp_get_forum_post_type() );
7 8 $forum_count = (int) ( $fcount->publish + $fcount->hidden + $fcount->spam );
8 -$bbpc_opt = get_option( 'bbp_core_settings' );
9 -$filter_set = $bbpc_opt['filter_buttons'] ?? [ 'open', 'closed', 'hidden', 'no_reply', 'all', 'trash' ];
10 9 ?>
11 10 <div class="wrap">
12 11 <div class="body-dark">
13 12 <?php
@@ -13,30 +12,24 @@
13 12 <?php
14 13 if ( $forum_count > 0 ) :
15 14 include __DIR__ . '/admin_ui/header.php';
16 15 ?>
17 -
18 16 <main>
19 17 <div class="easydocs-sidebar-menu">
20 18 <div class="tab-container">
21 19 <?php
22 - $forum_query = new WP_Query(
23 - [
24 - 'post_type' => bbp_get_forum_post_type(),
25 - 'posts_per_page' => -1,
26 - 'post_parent' => 0,
27 - 'orderby' => 'menu_order',
28 - 'order' => 'ASC',
29 - 'post_status' => 'publish',
30 - ]
31 - );
32 -
20 + $forum_query = new WP_Query( [
21 + 'post_type' => bbp_get_forum_post_type(),
22 + 'posts_per_page' => -1,
23 + 'post_parent' => 0,
24 + 'orderby' => 'menu_order',
25 + 'order' => 'ASC',
26 + 'post_status' => 'publish',
27 + ] );
33 28 $count = $forum_query->found_posts;
34 -
35 29 // Left Sidebar Forums.
36 30 include __DIR__ . '/admin_ui/forums.php';
37 31 ?>
38 -
39 32 <div class="easydocs-tab-content">
40 33 <?php
41 34 $ids = 0;
42 35 $container = 1;
@@ -64,20 +57,16 @@
64 57 $count_solved = 0;
65 58 $count_unsolved = 0;
66 59 $count_trash = 0;
67 60
68 - while ( $children->have_posts() ) :
69 - $children->the_post();
61 + while ( $children->have_posts() ) : $children->the_post();
70 62 $topic_id = get_the_ID();
63 + $replies = get_children( [
64 + 'post_parent' => $topic_id,
65 + 'post_type' => bbp_get_reply_post_type(),
66 + 'post_status' => [ 'publish', 'draft', 'pending' ],
67 + ] );
71 68
72 - $replies = get_children(
73 - [
74 - 'post_parent' => $topic_id,
75 - 'post_type' => bbp_get_reply_post_type(),
76 - 'post_status' => [ 'publish', 'draft', 'pending' ],
77 - ]
78 - );
79 -
80 69 // Count open/closed topics.
81 70 if ( bbp_is_topic_closed( $topic_id ) ) {
82 71 $count_closed++;
83 72 } else {
@@ -84,9 +73,9 @@
84 73 $count_open++;
85 74 }
86 75
87 76 // Count spam( hidden ) topics.
88 - if ( bbp_is_topic_spam( $topic_id ) ) {
77 + if ( bbp_is_topic_spam( $topic_id ) || bbp_is_topic_pending( $topic_id ) ) {
89 78 $count_hidden++;
90 79 }
91 80
92 81 // Replies count.
@@ -94,78 +83,88 @@
94 83 $count_no_reply++;
95 84 }
96 85
97 86 // Count solved.
98 - if ( $GLOBALS['bbp_solved_topic']->is_solved( $topic_id ) ) {
87 + // Before using $GLOBALS['forumax_solve_topic'], check if it is set
88 + if (isset($GLOBALS['forumax_solve_topic']) && $GLOBALS['forumax_solve_topic']->is_solved($topic_id)) {
99 89 $count_solved++;
100 90 } else {
101 91 $count_unsolved++;
102 92 }
103 -
93 + endwhile;
94 + wp_reset_postdata();
104 95
105 - endwhile;
106 -
107 - $trash_topic = new WP_Query(
108 - [
96 + $trash_topic = new WP_Query( [
109 97 'post_parent' => $item,
110 98 'post_type' => bbp_get_topic_post_type(),
111 99 'posts_per_page' => -1,
112 100 'post_status' => [ 'trash' ],
113 - ]
114 - );
115 -
116 - while ( $trash_topic->have_posts() ) :
117 - $trash_topic->the_post();
118 - $trash_topic_id = get_the_ID();
119 - // Count trash.
120 - if ( bbp_is_topic_trash( $trash_topic_id ) ) {
121 - $count_trash++;
122 - }
123 - endwhile; wp_reset_postdata();
124 - ?>
125 - <div class="easydocs-tab <?php echo esc_attr( $active ); ?>" id="tab-<?php echo esc_attr( $item ); ?>">
101 + ] );
102 +
103 + while ( $trash_topic->have_posts() ) :
104 + $trash_topic->the_post();
105 + $trash_topic_id = get_the_ID();
106 + // Count trash.
107 + if ( bbp_is_topic_trash( $trash_topic_id ) ) {
108 + $count_trash++;
109 + }
110 + endwhile;
111 + wp_reset_postdata();
112 + ?>
113 + <div class="easydocs-tab <?php echo esc_attr( $active ); ?>" id="tab-<?php echo esc_attr( $item ); ?>">
126 114
127 - <!-- Tab filters. -->
128 - <?php include __DIR__ . '/admin_ui/tab_filters.php'; ?>
115 + <!-- Tab filters. -->
116 + <?php include __DIR__ . '/admin_ui/tab_filters.php'; ?>
129 117
130 - <!-- Children topics. -->
131 - <?php include __DIR__ . '/admin_ui/topics.php'; ?>
118 + <!-- Children topics. -->
119 + <?php include __DIR__ . '/admin_ui/topics.php'; ?>
132 120
133 - <a class="easydocs-btn easydocs-btn-outline-blue easydocs-btn-sm easydocs-btn-round button button-info section-doc" id="bbpc-topic" target="_blank" name="submit" href="<?php echo admin_url( 'admin.php' ); ?>/Create_Topic.php?bbp_parentID=<?php echo $item; ?>&is_bbp_section=">
134 - <?php esc_html_e( 'Add Topic', 'bbp-core' ); ?>
135 - </a>
136 - </div>
121 + <?php if ( $children->post_count > 0 ) : ?>
122 + <div class="controls bbpc-admin-pagination" style="display:none;">
123 + <div class="mixitup-control mixitup-page-list"></div>
124 + </div>
125 + <?php endif; ?>
126 +
127 + <a class="easydocs-btn easydocs-btn-outline-blue easydocs-btn-sm easydocs-btn-round button button-info section-doc" id="bbpc-topic" target="_blank" name="submit" href="javascript:void(0)" bbp_forum_id="<?php echo esc_attr( $item ); ?>">
128 + <?php esc_html_e( 'Add Topic', 'forumax' ); ?>
129 + </a>
130 + </div>
137 131 <?php
138 - endforeach;
139 - endif;
140 - ?>
132 + endforeach;
133 + endif;
134 + ?>
135 + </div>
141 136 </div>
142 137 </div>
138 + </main>
139 + <?php
140 + else :
141 + ?>
142 + <div class="eazydocs-no-content">
143 + <img src="<?php echo esc_url( FORUMAX_IMG . 'icon/folder-open.png' ); ?>" alt="<?php esc_attr_e( 'Folder Open', 'forumax' ); ?>">
144 + <p class="big-p"> <?php esc_html_e( 'No forums found. Get started by creating a new forum or importing demo data.', 'forumax' ); ?> </p>
145 + <p class="forumax-empty-actions">
146 + <a href="javascript:void(0)" type="button" id="bbpc-forum" class="button button-primary ezd-btn btn-lg">
147 + <span class="dashicons dashicons-plus-alt2"></span>
148 + <?php esc_html_e( 'Create Forum', 'forumax' ); ?>
149 + </a>
150 + <span class="forumax-actions-separator"><?php esc_html_e( 'or', 'forumax' ); ?></span>
151 + <a href="javascript:void(0)" type="button" id="forumax-import-demo" class="button ezd-btn btn-lg forumax-import-demo-btn">
152 + <span class="dashicons dashicons-database-import"></span>
153 + <?php esc_html_e( 'Import Demo Data', 'forumax' ); ?>
154 + </a>
155 + </p>
143 156 </div>
144 - </main>
145 - <?php
146 - else :
157 + <?php
158 + endif;
147 159 ?>
148 - <div class="eazydocs-no-content">
149 - <img src="<?php echo BBPC_IMG; ?>/icon/folder-open.png" alt="<?php esc_attr_e( 'Folder Open', 'bbp-core' ); ?>">
150 - <p class="big-p"> <?php esc_html_e( 'No forum has been found . Perhaps', 'bbp-core' ); ?> </p>
151 - <p> <br>
152 - <a href="<?php echo admin_url( 'admin.php' ); ?>/Create_Forum.php?bbp_parent_title=" target="_blank" type="button" id="bbpc-forum" class="button button-primary ezd-btn btn-lg">
153 - <?php esc_html_e( 'Create Forum', 'bbp-core' ); ?>
154 - </a>
155 - </p>
156 - </div>
157 - <?php
158 - endif; //TODO: Fix open topics not being selected issue.
159 - ?>
160 + </div>
160 161 </div>
161 -</div>
162 162
163 163 <script>
164 164 (function ($) {
165 165 $(document).ready(function () {
166 166 let docContainer = document.querySelectorAll('.easydocs-tab');
167 -
168 167 var config = {
169 168 controls: {
170 169 scope: 'local',
171 170 },
@@ -172,15 +171,31 @@
172 171 animation: {
173 172 enable: false,
174 173 },
175 174 load: {
176 - filter: '<?php echo esc_js( $bbpc_opt['default_filter'] ?? '.open-topics' ); ?>'
175 + filter: '<?php echo esc_js( forumax_get_opt( 'default_filter', '.open-topics' ) ); ?>'
176 + },
177 + pagination: {
178 + limit: 10,
179 + },
180 + callbacks: {
181 + onMixEnd: function(state) {
182 + var pagination = state.container.querySelector('.bbpc-admin-pagination');
183 + if ( pagination ) {
184 + // Count matching items directly from the DOM using the active
185 + // filter selector. MixItUp always renders prev/next buttons so
186 + // children.length is unreliable for detecting multi-page results.
187 + var selector = state.activeFilter ? state.activeFilter.selector : '';
188 + var matchCount = ( ! selector || selector === 'all' )
189 + ? state.container.querySelectorAll('.mix').length
190 + : state.container.querySelectorAll(selector).length;
191 + pagination.style.display = matchCount > 10 ? 'block' : 'none';
192 + }
193 + }
177 194 }
178 195 };
179 -
180 196 for (let i = 0; i < docContainer.length; i++) {
181 197 var mixer1 = mixitup(docContainer[i], config);
182 198 }
183 199 });
184 200 })(jQuery);
185 -</script>
186 -
201 +</script>