PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 1.2.1
Forumax – AI Powered Advanced Community Forum Plugin v1.2.1
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.php

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

186 lines 5.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! class_exists( 'bbPress' ) ) {
3 return;
4 }
5
6 $parent_forums = [];
7 $fcount = wp_count_posts( bbp_get_forum_post_type() );
8 $forum_count = (int) ( $fcount->publish + $fcount->hidden + $fcount->spam );
9 $bbpc_opt = get_option( 'bbp_core_settings' );
10 ?>
11 <div class="wrap">
12 <div class="body-dark">
13 <?php
14 if ( $forum_count > 0 ) :
15 include __DIR__ . '/admin_ui/header.php';
16 ?>
17 <main>
18 <div class="easydocs-sidebar-menu">
19 <div class="tab-container">
20 <?php
21 $forum_query = new WP_Query(
22 [
23 'post_type' => bbp_get_forum_post_type(),
24 'posts_per_page' => -1,
25 'post_parent' => 0,
26 'orderby' => 'menu_order',
27 'order' => 'ASC',
28 'post_status' => 'publish',
29 ]
30 );
31
32 $count = $forum_query->found_posts;
33
34 // Left Sidebar Forums.
35 include __DIR__ . '/admin_ui/forums.php';
36 ?>
37
38 <div class="easydocs-tab-content">
39 <?php
40 $ids = 0;
41 $container = 1;
42 if ( is_array( $parent_forums ) ) :
43 foreach ( $parent_forums as $item ) :
44 $ids ++;
45 $container ++;
46 $active = $ids == 1 ? ' tab-active' : '';
47
48 $children = new WP_Query(
49 [
50 'post_parent' => $item,
51 'post_type' => bbp_get_topic_post_type(),
52 'orderby' => 'menu_order',
53 'order' => 'asc',
54 'posts_per_page' => -1,
55 'post_status' => [ 'any', 'spam' ],
56 ]
57 );
58
59 $count_open = 0;
60 $count_closed = 0;
61 $count_hidden = 0;
62 $count_no_reply = 0;
63 $count_solved = 0;
64 $count_unsolved = 0;
65 $count_trash = 0;
66
67 while ( $children->have_posts() ) :
68 $children->the_post();
69 $topic_id = get_the_ID();
70
71 $replies = get_children(
72 [
73 'post_parent' => $topic_id,
74 'post_type' => bbp_get_reply_post_type(),
75 'post_status' => [ 'publish', 'draft', 'pending' ],
76 ]
77 );
78
79 // Count open/closed topics.
80 if ( bbp_is_topic_closed( $topic_id ) ) {
81 $count_closed++;
82 } else {
83 $count_open++;
84 }
85
86 // Count spam( hidden ) topics.
87 if ( bbp_is_topic_spam( $topic_id ) ) {
88 $count_hidden++;
89 }
90
91 // Replies count.
92 if ( 0 == count( $replies ) ) {
93 $count_no_reply++;
94 }
95
96 // Count solved.
97 // Before using $GLOBALS['bbp_solved_topic'], check if it is set
98 if (isset($GLOBALS['bbp_solved_topic']) && $GLOBALS['bbp_solved_topic']->is_solved($topic_id)) {
99 $count_solved++;
100 } else {
101 $count_unsolved++;
102 }
103
104 endwhile; wp_reset_postdata();
105
106 $trash_topic = new WP_Query(
107 [
108 'post_parent' => $item,
109 'post_type' => bbp_get_topic_post_type(),
110 'posts_per_page' => -1,
111 'post_status' => [ 'trash' ],
112 ]
113 );
114
115 while ( $trash_topic->have_posts() ) :
116 $trash_topic->the_post();
117 $trash_topic_id = get_the_ID();
118 // Count trash.
119 if ( bbp_is_topic_trash( $trash_topic_id ) ) {
120 $count_trash++;
121 }
122 endwhile; wp_reset_postdata();
123 ?>
124 <div class="easydocs-tab <?php echo esc_attr( $active ); ?>" id="tab-<?php echo esc_attr( $item ); ?>">
125
126 <!-- Tab filters. -->
127 <?php include __DIR__ . '/admin_ui/tab_filters.php'; ?>
128
129 <!-- Children topics. -->
130 <?php include __DIR__ . '/admin_ui/topics.php'; ?>
131
132 <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=">
133 <?php esc_html_e( 'Add Topic', 'bbp-core' ); ?>
134 </a>
135 </div>
136 <?php
137 endforeach;
138 endif;
139 ?>
140 </div>
141 </div>
142 </div>
143 </main>
144 <?php
145 else :
146 ?>
147 <div class="eazydocs-no-content">
148 <img src="<?php echo BBPC_IMG; ?>/icon/folder-open.png" alt="<?php esc_attr_e( 'Folder Open', 'bbp-core' ); ?>">
149 <p class="big-p"> <?php esc_html_e( 'No forum has been found . Perhaps', 'bbp-core' ); ?> </p>
150 <p> <br>
151 <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">
152 <?php esc_html_e( 'Create Forum', 'bbp-core' ); ?>
153 </a>
154 </p>
155 </div>
156 <?php
157 endif; //TODO: Fix open topics not being selected issue.
158 ?>
159 </div>
160 </div>
161
162 <script>
163 (function ($) {
164 $(document).ready(function () {
165 let docContainer = document.querySelectorAll('.easydocs-tab');
166
167 var config = {
168 controls: {
169 scope: 'local',
170 },
171 animation: {
172 enable: false,
173 },
174 load: {
175 filter: '<?php echo esc_js( $bbpc_opt['default_filter'] ?? '.open-topics' ); ?>'
176 }
177 };
178
179 for (let i = 0; i < docContainer.length; i++) {
180 var mixer1 = mixitup(docContainer[i], config);
181 }
182 });
183 })(jQuery);
184 </script>
185
186