dashboard.php
5 months ago
download-history.php
5 months ago
edit-profile.php
5 months ago
profile.php
5 months ago
dashboard.php
106 lines
| 1 | <?php |
| 2 | /** |
| 3 | * User Dashboard - Main Layout |
| 4 | * Slack-style modern interface |
| 5 | */ |
| 6 | |
| 7 | global $current_user; |
| 8 | $store = get_user_meta(get_current_user_id(), '__wpdm_public_profile', true); |
| 9 | $avatar_url = isset($store['logo']) && $store['logo'] != '' ? $store['logo'] : get_avatar_url($current_user->user_email, ['size' => 256]); |
| 10 | ?> |
| 11 | |
| 12 | <div class="w3eden wpdm-dashboard"> |
| 13 | <div class="wpdm-dashboard-frame"> |
| 14 | <!-- Sidebar --> |
| 15 | <aside class="wpdm-sidebar" id="wpdm-sidebar"> |
| 16 | <!-- User Profile (Top) --> |
| 17 | <div class="wpdm-sidebar-header"> |
| 18 | <div class="wpdm-user-profile"> |
| 19 | <div class="wpdm-user-avatar"> |
| 20 | <img src="<?php echo esc_url($avatar_url); ?>" alt="<?php echo esc_attr($current_user->display_name); ?>"> |
| 21 | <span class="wpdm-user-status"></span> |
| 22 | </div> |
| 23 | <div class="wpdm-user-info"> |
| 24 | <span class="wpdm-user-name"><?php echo esc_html($current_user->display_name); ?></span> |
| 25 | <span class="wpdm-user-role"><?php echo esc_html(ucfirst($current_user->roles[0] ?? 'User')); ?></span> |
| 26 | </div> |
| 27 | </div> |
| 28 | </div> |
| 29 | |
| 30 | <!-- Navigation --> |
| 31 | <nav class="wpdm-sidebar-nav"> |
| 32 | <?php |
| 33 | if (is_array($this->dashboard_menu)) { |
| 34 | foreach ($this->dashboard_menu as $section_id => $section) { |
| 35 | if (isset($section['title']) && $section['title'] != '') { |
| 36 | echo '<div class="wpdm-nav-group-title">' . esc_html($section['title']) . '</div>'; |
| 37 | } |
| 38 | echo '<div class="wpdm-nav-group">'; |
| 39 | foreach ($section['items'] as $page_id => $menu_item) { |
| 40 | $menu_url = get_permalink(get_the_ID()) . ($page_id != '' ? '?udb_page=' . $page_id : ''); |
| 41 | if (isset($params['flaturl']) && $params['flaturl'] == 1) { |
| 42 | $menu_url = get_permalink(get_the_ID()) . $page_id . ($page_id != '' ? '/' : ''); |
| 43 | } |
| 44 | $is_active = ($udb_page == $page_id) ? 'active' : ''; |
| 45 | $icon = isset($menu_item['icon']) ? $menu_item['icon'] : (isset($default_icons[$page_id]) ? $default_icons[$page_id] : 'fas fa-circle'); |
| 46 | ?> |
| 47 | <a class="wpdm-nav-link <?php echo $is_active; ?>" href="<?php echo esc_url($menu_url); ?>"> |
| 48 | <i class="<?php echo esc_attr($icon); ?>"></i> |
| 49 | <span><?php echo esc_html($menu_item['name']); ?></span> |
| 50 | </a> |
| 51 | <?php |
| 52 | } |
| 53 | echo '</div>'; |
| 54 | } |
| 55 | } |
| 56 | ?> |
| 57 | </nav> |
| 58 | |
| 59 | <?php do_action("wpdm_user_dashboard_sidebar"); ?> |
| 60 | |
| 61 | <!-- Logout (Bottom) --> |
| 62 | <div class="wpdm-sidebar-footer"> |
| 63 | <a class="wpdm-logout-link" href="<?php echo esc_url(wpdm_logout_url()); ?>"> |
| 64 | <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg> |
| 65 | <span><?php esc_html_e('Logout', 'download-manager'); ?></span> |
| 66 | </a> |
| 67 | </div> |
| 68 | </aside> |
| 69 | |
| 70 | <!-- Mobile Menu Toggle --> |
| 71 | <button type="button" class="wpdm-mobile-toggle" id="wpdm-mobile-toggle"> |
| 72 | <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg> |
| 73 | </button> |
| 74 | |
| 75 | <!-- Main Content --> |
| 76 | <main class="wpdm-main"> |
| 77 | <div class="wpdm-main-inner"> |
| 78 | <?php echo isset($dashboard_contents) ? $dashboard_contents : ''; ?> |
| 79 | </div> |
| 80 | </main> |
| 81 | </div> |
| 82 | |
| 83 | <!-- Mobile Overlay --> |
| 84 | <div class="wpdm-overlay" id="wpdm-overlay"></div> |
| 85 | </div> |
| 86 | |
| 87 | <script> |
| 88 | jQuery(function($) { |
| 89 | var $sidebar = $('#wpdm-sidebar'); |
| 90 | var $overlay = $('#wpdm-overlay'); |
| 91 | var $toggle = $('#wpdm-mobile-toggle'); |
| 92 | |
| 93 | $toggle.on('click', function() { |
| 94 | $sidebar.addClass('open'); |
| 95 | $overlay.addClass('visible'); |
| 96 | $('body').css('overflow', 'hidden'); |
| 97 | }); |
| 98 | |
| 99 | $overlay.on('click', function() { |
| 100 | $sidebar.removeClass('open'); |
| 101 | $overlay.removeClass('visible'); |
| 102 | $('body').css('overflow', ''); |
| 103 | }); |
| 104 | }); |
| 105 | </script> |
| 106 |