PluginProbe ʕ •ᴥ•ʔ
Download Manager / trunk
Download Manager vtrunk
3.3.62 3.3.61 3.3.60 3.3.59 3.3.58 3.3.57 3.3.56 trunk 2.1.3 2.3.0 2.5.96 2.5.97 2.6.2 2.6.96 2.8.3 2.9.99 3.0.4 3.1.05 3.1.07 3.1.08 3.1.11 3.1.12 3.1.14 3.1.17 3.1.18 3.1.22 3.1.23 3.1.24 3.1.25 3.1.26 3.1.27 3.1.28 3.2.04 3.2.13 3.2.14 3.2.16 3.2.18 3.2.19 3.2.21 3.2.22 3.2.23 3.2.24 3.2.25 3.2.27 3.2.28 3.2.29 3.2.30 3.2.31 3.2.32 3.2.33 3.2.34 3.2.35 3.2.37 3.2.38 3.2.39 3.2.40 3.2.41 3.2.42 3.2.43 3.2.44 3.2.45 3.2.46 3.2.47 3.2.48 3.2.49 3.2.50 3.2.51 3.2.52 3.2.53 3.2.54 3.2.55 3.2.56 3.2.57 3.2.58 3.2.59 3.2.60 3.2.61 3.2.63 3.2.64 3.2.65 3.2.66 3.2.67 3.2.68 3.2.69 3.2.70 3.2.71 3.2.72 3.2.73 3.2.74 3.2.75 3.2.76 3.2.77 3.2.78 3.2.79 3.2.80 3.2.81 3.2.82 3.2.83 3.2.84 3.2.85 3.2.86 3.2.87 3.2.88 3.2.89 3.2.90 3.2.91 3.2.92 3.2.93 3.2.94 3.2.95 3.2.96 3.2.97 3.2.98 3.2.99 3.3.00 3.3.01 3.3.02 3.3.03 3.3.04 3.3.05 3.3.06 3.3.07 3.3.08 3.3.09 3.3.10 3.3.11 3.3.12 3.3.13 3.3.14 3.3.15 3.3.16 3.3.17 3.3.18 3.3.19 3.3.20 3.3.21 3.3.22 3.3.23 3.3.24 3.3.25 3.3.26 3.3.27 3.3.28 3.3.29 3.3.30 3.3.31 3.3.32 3.3.33 3.3.34 3.3.35 3.3.36 3.3.37 3.3.38 3.3.39 3.3.40 3.3.41 3.3.42 3.3.43 3.3.44 3.3.45 3.3.46 3.3.47 3.3.48 3.3.49 3.3.50 3.3.51 3.3.52 3.3.53 3.3.54 3.3.55
download-manager / src / User / views / dashboard / profile.php
download-manager / src / User / views / dashboard Last commit date
dashboard.php 5 months ago download-history.php 5 months ago edit-profile.php 5 months ago profile.php 5 months ago
profile.php
231 lines
1 <?php
2 /**
3 * User Dashboard - Profile/Home
4 * Enterprise-grade design
5 */
6
7 global $current_user, $wpdb;
8
9 $total_downloads = (int) $wpdb->get_var($wpdb->prepare(
10 "SELECT COUNT(*) FROM {$wpdb->prefix}ahm_download_stats WHERE uid = %d",
11 $current_user->ID
12 ));
13
14 $today_downloads = (int) $wpdb->get_var($wpdb->prepare(
15 "SELECT COUNT(*) FROM {$wpdb->prefix}ahm_download_stats WHERE uid = %d AND `year` = YEAR(CURDATE()) AND `month` = MONTH(CURDATE()) AND `day` = DAY(CURDATE())",
16 $current_user->ID
17 ));
18
19 $this_month_downloads = (int) $wpdb->get_var($wpdb->prepare(
20 "SELECT COUNT(*) FROM {$wpdb->prefix}ahm_download_stats WHERE uid = %d AND `year` = YEAR(CURDATE()) AND `month` = MONTH(CURDATE())",
21 $current_user->ID
22 ));
23 ?>
24
25 <?php do_action("wpdm_before_user_dashboard_summery"); ?>
26
27 <!-- Stats Grid -->
28 <div class="wpdm-stats-grid">
29 <div class="wpdm-stat-card">
30 <div class="wpdm-stat-icon wpdm-stat-icon--success">
31 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>
32 </div>
33 <div class="wpdm-stat-content">
34 <span class="wpdm-stat-label"><?php esc_html_e('Total Downloads', 'download-manager'); ?></span>
35 <span class="wpdm-stat-value"><?php echo number_format($total_downloads); ?></span>
36 </div>
37 </div>
38
39 <div class="wpdm-stat-card">
40 <div class="wpdm-stat-icon wpdm-stat-icon--info">
41 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>
42 </div>
43 <div class="wpdm-stat-content">
44 <span class="wpdm-stat-label"><?php esc_html_e('This Month', 'download-manager'); ?></span>
45 <span class="wpdm-stat-value"><?php echo number_format($this_month_downloads); ?></span>
46 </div>
47 </div>
48
49 <div class="wpdm-stat-card">
50 <div class="wpdm-stat-icon wpdm-stat-icon--warning">
51 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>
52 </div>
53 <div class="wpdm-stat-content">
54 <span class="wpdm-stat-label"><?php esc_html_e('Today', 'download-manager'); ?></span>
55 <span class="wpdm-stat-value"><?php echo number_format($today_downloads); ?></span>
56 </div>
57 </div>
58 </div>
59
60 <?php do_action("wpdm_after_user_dashboard_summery"); ?>
61
62 <?php
63 // Recommended Downloads
64 if (isset($params['recommended']) && (term_exists($params['recommended'], 'wpdmcategory') || $params['recommended'] == 'recent')) {
65 $qparams = [
66 'post_type' => 'wpdmpro',
67 'posts_per_page' => 6,
68 'orderby' => 'rand'
69 ];
70
71 if ($params['recommended'] != 'recent') {
72 $qparams['tax_query'] = [['taxonomy' => 'wpdmcategory', 'field' => 'slug', 'terms' => explode(",", $params['recommended'])]];
73 } else {
74 $qparams['orderby'] = 'date';
75 }
76
77 $q = new WP_Query($qparams);
78 if ($q->have_posts()) {
79 ?>
80 <div class="wpdm-card" style="margin-top: 1.5rem;">
81 <div class="wpdm-card-header">
82 <h3>
83 <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"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>
84 <?php esc_html_e('Recommended Downloads', 'download-manager'); ?>
85 </h3>
86 </div>
87 <div class="wpdm-card-body">
88 <div class="wpdm-recommended-grid">
89 <?php
90 while ($q->have_posts()) {
91 $q->the_post();
92 if (WPDM()->package->userCanAccess(get_the_ID())) {
93 ?>
94 <a href="<?php the_permalink(); ?>" class="wpdm-recommended-item">
95 <div class="wpdm-recommended-thumb">
96 <?php
97 $thumb = wpdm_thumb(get_the_ID(), [300, 225], 'url');
98 if ($thumb) {
99 echo '<img src="' . esc_url($thumb) . '" alt="' . esc_attr(get_the_title()) . '" class="wpdm-recommended-img">';
100 }
101 ?>
102 </div>
103 <span class="wpdm-recommended-title"><?php the_title(); ?></span>
104 </a>
105 <?php
106 }
107 }
108 wp_reset_postdata();
109 ?>
110 </div>
111 </div>
112 </div>
113 <?php
114 }
115 }
116 ?>
117
118 <?php
119 // Favourites
120 if (isset($params['fav']) && (int)$params['fav'] == 1) {
121 $myfavs = maybe_unserialize(get_user_meta(get_current_user_id(), '__wpdm_favs', true));
122 if (!empty($myfavs)) {
123 ?>
124 <div class="wpdm-card" style="margin-top: 1.5rem;">
125 <div class="wpdm-card-header">
126 <h3>
127 <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="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"></path></svg>
128 <?php esc_html_e('My Favourites', 'download-manager'); ?>
129 </h3>
130 </div>
131 <div class="wpdm-table-wrap">
132 <table class="wpdm-table">
133 <thead>
134 <tr>
135 <th><?php esc_html_e('Package Name', 'download-manager'); ?></th>
136 <th style="width: 100px; text-align: right;"><?php esc_html_e('Action', 'download-manager'); ?></th>
137 </tr>
138 </thead>
139 <tbody>
140 <?php
141 foreach ($myfavs as $fav) {
142 $fav_post = get_post($fav);
143 if (is_object($fav_post) && $fav_post->post_type == 'wpdmpro') {
144 ?>
145 <tr id="fav_<?php echo esc_attr($fav); ?>">
146 <td>
147 <a class="wpdm-table-link" href="<?php echo esc_url(get_permalink($fav_post->ID)); ?>">
148 <?php echo esc_html($fav_post->post_title); ?>
149 </a>
150 </td>
151 <td style="text-align: right;">
152 <?php echo WPDM()->package->favBtn($fav, ['size' => 'btn-xs rem-fav fav_' . $fav, 'a2f_label' => __('Remove', 'download-manager'), 'rff_label' => __('Remove', 'download-manager')], false); ?>
153 </td>
154 </tr>
155 <?php
156 }
157 }
158 ?>
159 </tbody>
160 </table>
161 </div>
162 </div>
163 <?php
164 }
165 }
166 ?>
167
168 <!-- Recent Downloads -->
169 <div class="wpdm-card" style="margin-top: 1.5rem;">
170 <div class="wpdm-card-header">
171 <h3>
172 <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"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>
173 <?php esc_html_e('Recent Downloads', 'download-manager'); ?>
174 </h3>
175 </div>
176 <?php
177 $recent = $wpdb->get_results($wpdb->prepare(
178 "SELECT p.post_title, s.* FROM {$wpdb->prefix}posts p, {$wpdb->prefix}ahm_download_stats s WHERE s.uid = %d AND s.pid = p.ID ORDER BY s.timestamp DESC LIMIT 5",
179 $current_user->ID
180 ));
181 ?>
182 <?php if (!empty($recent)) : ?>
183 <div class="wpdm-table-wrap">
184 <table class="wpdm-table">
185 <thead>
186 <tr>
187 <th><?php esc_html_e('Package Name', 'download-manager'); ?></th>
188 <th class="wpdm-hide-mobile"><?php esc_html_e('Download Time', 'download-manager'); ?></th>
189 <th class="wpdm-hide-mobile"><?php esc_html_e('IP Address', 'download-manager'); ?></th>
190 </tr>
191 </thead>
192 <tbody>
193 <?php foreach ($recent as $stat) : ?>
194 <tr>
195 <td>
196 <a class="wpdm-table-link" href="<?php echo esc_url(get_permalink($stat->pid)); ?>">
197 <?php echo esc_html($stat->post_title); ?>
198 </a>
199 </td>
200 <td class="wpdm-hide-mobile">
201 <span class="wpdm-date"><?php echo date_i18n(get_option('date_format') . " H:i", $stat->timestamp + wpdm_tzoffset()); ?></span>
202 </td>
203 <td class="wpdm-hide-mobile">
204 <span class="wpdm-ip"><?php echo esc_html($stat->ip); ?></span>
205 </td>
206 </tr>
207 <?php endforeach; ?>
208 </tbody>
209 </table>
210 </div>
211 <?php else : ?>
212 <div class="wpdm-card-body">
213 <div class="wpdm-empty-state wpdm-empty-state--compact">
214 <svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>
215 <p><?php esc_html_e('No downloads yet', 'download-manager'); ?></p>
216 </div>
217 </div>
218 <?php endif; ?>
219 </div>
220
221 <script>
222 jQuery(function($) {
223 $('.rem-fav').on('click', function() {
224 var ret = $(this).attr('class').match(/fav_([0-9]+)/);
225 if (ret && ret[1]) {
226 $('#fav_' + ret[1]).fadeOut(300, function() { $(this).remove(); });
227 }
228 });
229 });
230 </script>
231