PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.2.0
Forumax – AI Powered Advanced Community Forum Plugin v2.2.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 2.1.0 All 29 releases
← All changes | includes/admin/Menu.php +70 -15 1.2.92.2.0 View file →
@@ -1,28 +1,70 @@
1 1 <?php
2 2 namespace admin;
3 3
4 +/**
5 + * Menu class for Forumax admin pages.
6 + *
7 + * Handles the registration and rendering of all admin menu pages.
8 + *
9 + * @package Forumax
10 + * @since 1.0.0
11 + */
4 12 class Menu {
5 - function __construct() {
6 - add_action( 'admin_menu', [ $this, 'bbpc_admin_menu' ] );
13 +
14 + /**
15 + * Constructor.
16 + *
17 + * Initializes the menu hooks.
18 + */
19 + public function __construct() {
20 + add_action( 'admin_menu', [ $this, 'forumax_admin_menu' ] );
7 21 }
8 22
9 23 /**
10 - * Create Admin menu
24 + * Create Admin menu and submenu pages.
11 25 *
26 + * Registers the main Forumax menu and all submenu pages.
27 + * The main menu opens the Dashboard page.
28 + *
12 29 * @return void
13 30 */
14 - public function bbpc_admin_menu() {
31 + public function forumax_admin_menu() {
15 32 $capability = 'manage_options';
16 33
17 - add_menu_page( __( 'BBP Core', 'bbp-core' ), __( 'BBP Core', 'bbp-core' ), $capability, 'bbp-core', [ $this, 'bbpc_plugin_page' ], 'dashicons-buddicons-bbpress-logo', 20 );
18 - add_submenu_page( 'bbp-core', __( 'Forums', 'bbp-core' ), __( 'Forums', 'bbp-core' ), $capability, 'bbp-core' );
19 - // add_submenu_page( 'bbp-core', __( 'BBP Core Dashboard', 'bbp-core' ), __( 'Dashboard', 'bbp-core' ), $capability, 'admin.php?page=bbp-core-dashboard', [ $this, 'bbpc_statistics_dashboard' ] );
34 + // Main menu page - opens Dashboard.
35 + add_menu_page(
36 + __( 'Forumax', 'forumax' ),
37 + __( 'Forumax', 'forumax' ),
38 + $capability,
39 + 'forumax',
40 + [ $this, 'forumax_dashboard_page' ],
41 + FORUMAX_IMG . 'admin/favicon.png',
42 + 20
43 + );
20 44
21 - // Remove menu items.
22 - $opt = get_option( 'bbp_core_settings' );
45 + // Dashboard submenu (matches parent slug so it doesn't duplicate).
46 + add_submenu_page(
47 + 'forumax',
48 + __( 'Dashboard', 'forumax' ),
49 + __( 'Dashboard', 'forumax' ),
50 + $capability,
51 + 'forumax',
52 + [ $this, 'forumax_dashboard_page' ]
53 + );
23 54
24 - if ( $opt['is_bbp_post_types_hidden'] ?? false ) {
55 + // Forum Builder submenu.
56 + add_submenu_page(
57 + 'forumax',
58 + __( 'Forum Builder', 'forumax' ),
59 + __( 'Forum Builder', 'forumax' ),
60 + $capability,
61 + 'forumax-builder',
62 + [ $this, 'forumax_plugin_page' ]
63 + );
64 +
65 + // Remove default bbPress menu items if setting is disabled.
66 + if ( ! forumax_get_opt( 'is_bbp_post_types_hidden' ) ) {
25 67 remove_menu_page( 'edit.php?post_type=forum' );
26 68 remove_menu_page( 'edit.php?post_type=topic' );
27 69 remove_menu_page( 'edit.php?post_type=reply' );
28 70 }
@@ -28,22 +70,35 @@
28 70 }
29 71 }
30 72
31 73 /**
32 - * Plugin page callback function.
74 + * Forum Builder page callback function.
33 75 *
76 + * Renders the main forum builder admin UI.
77 + *
34 78 * @return void
35 79 */
36 - public function bbpc_plugin_page() {
37 - $opt = get_option( 'bbp_core_settings' );
80 + public function forumax_plugin_page() {
38 81 include plugin_dir_path( __FILE__ ) . '/menu/admin_ui.php';
39 82 }
40 83
41 84 /**
42 - * Dashboard Statistics.
85 + * Dashboard page callback function.
43 86 *
87 + * Renders the comprehensive dashboard with statistics and activity.
88 + *
44 89 * @return void
45 90 */
46 - public function bbpc_statistics_dashboard() {
91 + public function forumax_dashboard_page() {
92 + include plugin_dir_path( __FILE__ ) . '/menu/dashboard.php';
93 + }
94 +
95 + /**
96 + * Legacy Dashboard Statistics.
97 + *
98 + * @deprecated 2.1.0 Use forumax_dashboard_page() instead.
99 + * @return void
100 + */
101 + public function forumax_statistics_dashboard() {
47 102 include plugin_dir_path( __FILE__ ) . '/menu/statistics.php';
48 103 }
49 104 }