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.php

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

171 lines 4.9 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 ?>
10 <div class="wrap">
11 <div class="body-dark">
12 <?php
13 if ( $forum_count > 0 ) :
14 include __DIR__ . '/admin_ui/header.php';
15 ?>
16 <main>
17 <div class="easydocs-sidebar-menu">
18 <div class="tab-container">
19 <?php
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 ] );
28 $count = $forum_query->found_posts;
29 // Left Sidebar Forums.
30 include __DIR__ . '/admin_ui/forums.php';
31 ?>
32 <div class="easydocs-tab-content">
33 <?php
34 $ids = 0;
35 $container = 1;
36 if ( is_array( $parent_forums ) ) :
37 foreach ( $parent_forums as $item ) :
38 $ids ++;
39 $container ++;
40 $active = $ids == 1 ? ' tab-active' : '';
41
42 $children = new WP_Query(
43 [
44 'post_parent' => $item,
45 'post_type' => bbp_get_topic_post_type(),
46 'orderby' => 'menu_order',
47 'order' => 'asc',
48 'posts_per_page' => -1,
49 'post_status' => [ 'any', 'spam' ],
50 ]
51 );
52
53 $count_open = 0;
54 $count_closed = 0;
55 $count_hidden = 0;
56 $count_no_reply = 0;
57 $count_solved = 0;
58 $count_unsolved = 0;
59 $count_trash = 0;
60
61 while ( $children->have_posts() ) : $children->the_post();
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 ] );
68
69 // Count open/closed topics.
70 if ( bbp_is_topic_closed( $topic_id ) ) {
71 $count_closed++;
72 } else {
73 $count_open++;
74 }
75
76 // Count spam( hidden ) topics.
77 if ( bbp_is_topic_spam( $topic_id ) || bbp_is_topic_pending( $topic_id ) ) {
78 $count_hidden++;
79 }
80
81 // Replies count.
82 if ( 0 == count( $replies ) ) {
83 $count_no_reply++;
84 }
85
86 // Count solved.
87 // Before using $GLOBALS['bbp_solved_topic'], check if it is set
88 if (isset($GLOBALS['bbp_solved_topic']) && $GLOBALS['bbp_solved_topic']->is_solved($topic_id)) {
89 $count_solved++;
90 } else {
91 $count_unsolved++;
92 }
93 endwhile;
94 wp_reset_postdata();
95
96 $trash_topic = new WP_Query( [
97 'post_parent' => $item,
98 'post_type' => bbp_get_topic_post_type(),
99 'posts_per_page' => -1,
100 'post_status' => [ 'trash' ],
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 ); ?>">
114
115 <!-- Tab filters. -->
116 <?php include __DIR__ . '/admin_ui/tab_filters.php'; ?>
117
118 <!-- Children topics. -->
119 <?php include __DIR__ . '/admin_ui/topics.php'; ?>
120
121 <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 ); ?>">
122 <?php esc_html_e( 'Add Topic', 'bbp-core' ); ?>
123 </a>
124 </div>
125 <?php
126 endforeach;
127 endif;
128 ?>
129 </div>
130 </div>
131 </div>
132 </main>
133 <?php
134 else :
135 ?>
136 <div class="eazydocs-no-content">
137 <img src="<?php echo BBPC_IMG; ?>/icon/folder-open.png" alt="<?php esc_attr_e( 'Folder Open', 'bbp-core' ); ?>">
138 <p class="big-p"> <?php esc_html_e( 'No forum has been found . Perhaps', 'bbp-core' ); ?> </p>
139 <p> <br>
140 <a href="javascript:void(0)" type="button" id="bbpc-forum" class="button button-primary ezd-btn btn-lg">
141 <?php esc_html_e( 'Create Forum', 'bbp-core' ); ?>
142 </a>
143 </p>
144 </div>
145 <?php
146 endif;
147 ?>
148 </div>
149 </div>
150
151 <script>
152 (function ($) {
153 $(document).ready(function () {
154 let docContainer = document.querySelectorAll('.easydocs-tab');
155 var config = {
156 controls: {
157 scope: 'local',
158 },
159 animation: {
160 enable: false,
161 },
162 load: {
163 filter: '<?php echo esc_js( bbpc_get_opt( 'default_filter', '.open-topics' ) ); ?>'
164 }
165 };
166 for (let i = 0; i < docContainer.length; i++) {
167 var mixer1 = mixitup(docContainer[i], config);
168 }
169 });
170 })(jQuery);
171 </script>