| 1 |
<?php |
| 2 |
|
| 3 |
// Exit if accessed directly |
| 4 |
if( !defined( 'ABSPATH' ) ) exit; |
| 5 |
|
| 6 |
function wpforo_add_menu(){ |
| 7 |
global $wpforo; |
| 8 |
|
| 9 |
$wpforo->moderation->spam_attachment(); |
| 10 |
|
| 11 |
$all_count = 0; |
| 12 |
$mod_count = $wpforo->post->unapproved_count(); $mod_count_num = intval($mod_count); |
| 13 |
$mod_count = ( $mod_count ) ? ' <span class="awaiting-mod count-1"><span class="pending-count">' . intval($mod_count) . '</span></span> ' : '' ; |
| 14 |
$ban_count = $wpforo->member->banned_count(); $ban_count_num = intval($ban_count); |
| 15 |
$ban_count = ( $ban_count ) ? ' <span class="awaiting-mod count-1"><span class="pending-count">' . intval($ban_count) . '</span></span> ' : '' ; |
| 16 |
$all_count = $mod_count_num + $ban_count_num; |
| 17 |
$all_count = ( $all_count ) ? ' <span class="awaiting-mod count-1"><span class="pending-count">' . intval($all_count) . '</span></span> ' : '' ; |
| 18 |
|
| 19 |
$position = ( isset($wpforo->general_options['menu_position']) && $wpforo->general_options['menu_position'] > 0 ) ? $wpforo->general_options['menu_position'] : 23; |
| 20 |
if( $wpforo->current_user_groupid == 1 || |
| 21 |
$wpforo->current_user_groupid == 2 || |
| 22 |
$wpforo->perm->usergroup_can('vm') || |
| 23 |
( $wpforo->perm->usergroup_can('cf') && |
| 24 |
$wpforo->perm->usergroup_can('ef') && |
| 25 |
$wpforo->perm->usergroup_can('df') ) |
| 26 |
) add_menu_page(__('Dashboard', 'wpforo'), __('Forums', 'wpforo') . $all_count , 'read', 'wpforo-community', 'wpforo_toplevel_page', 'dashicons-format-chat', $position); |
| 27 |
if( $wpforo->current_user_groupid == 1 || $wpforo->current_user_groupid == 2 ) add_submenu_page('wpforo-community', __('Dashboard', 'wpforo'), __('Dashboard', 'wpforo'), 'read', 'wpforo-community', 'wpforo_toplevel_page' ); |
| 28 |
if( $wpforo->perm->usergroup_can('cf') && $wpforo->perm->usergroup_can('ef') && $wpforo->perm->usergroup_can('df') ) add_submenu_page('wpforo-community', __('Forums', 'wpforo'), __('Forums', 'wpforo'), 'read', 'wpforo-forums', 'wpforo_forum_menu'); |
| 29 |
if( $wpforo->current_user_groupid == 1 ) add_submenu_page('wpforo-community', __('Settings', 'wpforo'), __('Settings', 'wpforo'), 'read', 'wpforo-settings', 'wpforo_settings'); |
| 30 |
if( $wpforo->current_user_groupid == 1 ) add_submenu_page('wpforo-community', __('Tools', 'wpforo'), __('Tools', 'wpforo'), 'read', 'wpforo-tools', 'wpforo_tools'); |
| 31 |
if( $wpforo->perm->usergroup_can('aum') ) add_submenu_page('wpforo-community', __('Moderation', 'wpforo'), __('Moderation' , 'wpforo') . $mod_count, 'read', 'wpforo-moderations', 'wpforo_moderations'); |
| 32 |
if( $wpforo->perm->usergroup_can('vm') ) add_submenu_page('wpforo-community', __('Members', 'wpforo'), __('Members', 'wpforo') . $ban_count, 'read', 'wpforo-members', 'wpforo_member_menu'); |
| 33 |
if( $wpforo->current_user_groupid == 1 ) add_submenu_page('wpforo-community', __('Usergroups', 'wpforo'), __('Usergroups', 'wpforo'), 'read', 'wpforo-usergroups', 'wpforo_usergroups_menu'); |
| 34 |
if( $wpforo->current_user_groupid == 1 ) add_submenu_page('wpforo-community', __('Phrases', 'wpforo'), __('Phrases', 'wpforo'), 'read', 'wpforo-phrases', 'wpforo_phrases'); |
| 35 |
if( $wpforo->current_user_groupid == 1 ) add_submenu_page('wpforo-community', __('Themes', 'wpforo'), __('Themes', 'wpforo'), 'read', 'wpforo-themes', 'wpforo_themes'); |
| 36 |
if( $wpforo->current_user_groupid == 1 ) add_submenu_page('wpforo-community', __('Addons', 'wpforo'), __('Addons', 'wpforo'), 'read', 'wpforo-addons', 'wpforo_addons'); |
| 37 |
//exit(); |
| 38 |
} |
| 39 |
add_action('admin_menu', 'wpforo_add_menu', 39); |
| 40 |
|
| 41 |
function wpforo_toplevel_page(){ |
| 42 |
global $wpforo; |
| 43 |
require( WPFORO_DIR . '/wpf-admin/dashboard.php' ); |
| 44 |
} |
| 45 |
|
| 46 |
function wpforo_forum_menu(){ |
| 47 |
global $wpforo; |
| 48 |
require( WPFORO_DIR . '/wpf-admin/forum.php' ); |
| 49 |
} |
| 50 |
|
| 51 |
function wpforo_member_menu(){ |
| 52 |
global $wpforo; |
| 53 |
require( WPFORO_DIR . '/wpf-admin/member.php' ); |
| 54 |
} |
| 55 |
|
| 56 |
function wpforo_usergroups_menu(){ |
| 57 |
global $wpforo; |
| 58 |
require( WPFORO_DIR . '/wpf-admin/usergroup.php' ); |
| 59 |
} |
| 60 |
|
| 61 |
function wpforo_settings(){ |
| 62 |
global $wpforo, $wpdb; |
| 63 |
require( WPFORO_DIR . '/wpf-admin/options.php' ); |
| 64 |
} |
| 65 |
|
| 66 |
function wpforo_themes(){ |
| 67 |
global $wpforo; |
| 68 |
require( WPFORO_DIR . '/wpf-admin/themes.php' ); |
| 69 |
} |
| 70 |
|
| 71 |
function wpforo_phrases(){ |
| 72 |
global $wpforo; |
| 73 |
require( WPFORO_DIR . '/wpf-admin/phrase.php' ); |
| 74 |
} |
| 75 |
|
| 76 |
function wpforo_integrations(){ |
| 77 |
global $wpforo; |
| 78 |
require( WPFORO_DIR . '/wpf-admin/integration.php' ); |
| 79 |
} |
| 80 |
|
| 81 |
function wpforo_addons(){ |
| 82 |
global $wpforo; |
| 83 |
require( WPFORO_DIR . '/wpf-admin/addons.php' ); |
| 84 |
} |
| 85 |
|
| 86 |
function wpforo_tools(){ |
| 87 |
global $wpforo; |
| 88 |
require( WPFORO_DIR . '/wpf-admin/tools.php' ); |
| 89 |
} |
| 90 |
|
| 91 |
function wpforo_moderations(){ |
| 92 |
global $wpforo; |
| 93 |
require( WPFORO_DIR . '/wpf-admin/moderation.php' ); |
| 94 |
} |
| 95 |
?> |