PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / trunk
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI vtrunk
8.0.1 8.0.2 8.0.0 7.9.9.7 7.9.9.6 7.9.9.5 7.9.9.4 7.9.9.3 7.9.9.2 7.9.9.1 7.9.9 7.9.8 7.9.7 7.9.6 7.9.5 7.9.4 7.9.3 7.9.2 7.9.1 7.9.0 7.8.9 7.8.8 7.8.7 7.8.6 7.8.5 All 44 releases
gamipress / includes / admin / pages / dashboard.php

dashboard.php in GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI trunk, at includes/admin/pages/dashboard.php

1,012 lines 44.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Admin Dashboard Page
4 *
5 * @package GamiPress\Admin\Dashboard
6 * @author GamiPress <contact@gamipress.com>, Ruben Garcia <rubengcdev@gmail.com>
7 * @since 2.0.0
8 */
9 // Exit if accessed directly
10 if( !defined( 'ABSPATH' ) ) exit;
11
12 /**
13 * Dashboard page
14 *
15 * @since 2.0.0
16 */
17 function gamipress_dashboard_page() {
18 ?>
19 <div class="wrap gamipress-dashboard">
20
21 <div id="icon-options-general" class="icon32"></div>
22 <h1 class="wp-heading-inline"><?php esc_html_e( 'Dashboard', 'gamipress' ); ?></h1>
23 <hr class="wp-header-end">
24
25 <div id="dashboard-widgets-wrap">
26 <div id="dashboard-widgets" class="metabox-holder">
27
28 <?php // Logo ?>
29 <div class="gamipress-dashboard-logo">
30 <img src="<?php echo GAMIPRESS_URL . 'assets/img/gamipress-brand-logo.svg' ?>" alt="GamiPress">
31 <strong class="gamipress-dashboard-version">v<?php echo GAMIPRESS_VER; ?></strong>
32 </div>
33
34 <?php // Dashboard ?>
35 <h1><?php echo esc_html_e( 'Dashboard', 'gamipress' ); ?></h1>
36
37 <div id="postbox-container-1" class="postbox-container">
38 <div id="normal-sortables" class="meta-box-sortables ui-sortable">
39
40 <?php // Points Types ?>
41 <?php gamipress_dashboard_box( array(
42 'id' => 'points',
43 'title' => gamipress_dashicon( 'star-filled' ) . __( 'Points Types', 'gamipress' ) . '<a href="' . admin_url( 'edit.php?post_type=points-type' ) . '" class="button button-primary">' . esc_html__( 'Edit', 'gamipress' ) . '</a>',
44 'content_cb' => 'gamipress_dashboard_points_types_box',
45 ) ); ?>
46
47 </div>
48 </div>
49
50 <div id="postbox-container-2" class="postbox-container">
51 <div id="normal-sortables" class="meta-box-sortables ui-sortable">
52
53 <?php // Achievement Types ?>
54 <?php gamipress_dashboard_box( array(
55 'id' => 'achievements',
56 'title' => gamipress_dashicon( 'awards' ) . __( 'Achievement Types', 'gamipress' ) . '<a href="' . admin_url( 'edit.php?post_type=achievement-type' ) . '" class="button button-primary">' . esc_html__( 'Edit', 'gamipress' ) . '</a>',
57 'content_cb' => 'gamipress_dashboard_achievement_types_box',
58 ) ); ?>
59
60 </div>
61 </div>
62
63 <div id="postbox-container-3" class="postbox-container">
64 <div id="normal-sortables" class="meta-box-sortables ui-sortable">
65
66 <?php // Rank Types ?>
67 <?php gamipress_dashboard_box( array(
68 'id' => 'ranks',
69 'title' => gamipress_dashicon( 'rank' ) . __( 'Rank Types', 'gamipress' ) . '<a href="' . admin_url( 'edit.php?post_type=rank-type' ) . '" class="button button-primary">' . esc_html__( 'Edit', 'gamipress' ) . '</a>',
70 'content_cb' => 'gamipress_dashboard_rank_types_box',
71 ) ); ?>
72
73 </div>
74 </div>
75
76 <div id="postbox-container-4" class="postbox-container">
77 <div id="normal-sortables" class="meta-box-sortables ui-sortable">
78
79 <?php // User Earnings ?>
80 <?php gamipress_dashboard_box( array(
81 'id' => 'user-earnings',
82 'title' => gamipress_dashicon( 'flag' ) . __( 'Latest User Earnings', 'gamipress' ) . '<a href="' . admin_url( 'admin.php?page=gamipress_user_earnings' ) . '" class="button button-primary">' . esc_html__( 'View All', 'gamipress' ) . '</a>',
83 'content_cb' => 'gamipress_dashboard_user_earnings_box',
84 ) ); ?>
85
86 </div>
87 </div>
88
89 <?php // Videos ?>
90 <h1><?php echo esc_html_e( 'Videos', 'gamipress' ); ?></h1>
91
92 <div id="normal-sortables" class="meta-box-sortables ui-sortable">
93
94 <?php // Videos ?>
95 <?php gamipress_dashboard_box( array(
96 'id' => 'videos',
97 'title' => '',
98 'content_cb' => 'gamipress_dashboard_videos_box',
99 ) ); ?>
100
101 </div>
102
103 <?php // Add-ons ?>
104 <?php gamipress_dashboard_add_ons_section(); ?>
105
106 <?php // Assets ?>
107 <?php gamipress_dashboard_assets_section(); ?>
108
109 <?php // Documentation ?>
110 <div class="gamipress-dashboard-docs-section">
111
112 <h1><?php echo esc_html_e( 'Documentation', 'gamipress' ); ?></h1>
113
114 <div id="postbox-container-1" class="postbox-container">
115 <div id="normal-sortables" class="meta-box-sortables ui-sortable">
116
117 <?php // Getting Started ?>
118 <?php gamipress_dashboard_box( array(
119 'id' => 'getting-started',
120 'title' => __( 'Getting Started', 'gamipress' ),
121 'content_cb' => 'gamipress_dashboard_getting_started_docs_box',
122 ) ); ?>
123
124 </div>
125 </div>
126
127 <div id="postbox-container-2" class="postbox-container">
128 <div id="normal-sortables" class="meta-box-sortables ui-sortable">
129
130 <?php // Features ?>
131 <?php gamipress_dashboard_box( array(
132 'id' => 'features-docs',
133 'title' => __( 'Features', 'gamipress' ),
134 'content_cb' => 'gamipress_dashboard_features_docs_box',
135 ) ); ?>
136
137 <?php // Tutorials ?>
138 <?php gamipress_dashboard_box( array(
139 'id' => 'tutorials-docs',
140 'title' => __( 'Tutorials', 'gamipress' ),
141 'content_cb' => 'gamipress_dashboard_tutorials_docs_box',
142 ) ); ?>
143
144 </div>
145 </div>
146
147 <div id="postbox-container-3" class="postbox-container">
148 <div id="normal-sortables" class="meta-box-sortables ui-sortable">
149
150 <?php // Blocks ?>
151 <?php gamipress_dashboard_box( array(
152 'id' => 'blocks',
153 'title' => __( 'Blocks, Shortcodes and Widgets', 'gamipress' ),
154 'content_cb' => 'gamipress_dashboard_blocks_box',
155 ) ); ?>
156
157 </div>
158 </div>
159
160 <div id="postbox-container-4" class="postbox-container">
161 <div id="normal-sortables" class="meta-box-sortables ui-sortable">
162
163 <?php // Support ?>
164 <?php gamipress_dashboard_box( array(
165 'id' => 'support',
166 'title' => __( 'Support', 'gamipress' ),
167 'content_cb' => 'gamipress_dashboard_support_box',
168 ) ); ?>
169
170 <?php // Advanced ?>
171 <?php gamipress_dashboard_box( array(
172 'id' => 'advanced-docs',
173 'title' => __( 'Advanced', 'gamipress' ),
174 'content_cb' => 'gamipress_dashboard_advanced_docs_box',
175 ) ); ?>
176
177 </div>
178 </div>
179 </div>
180
181 <?php // About ?>
182 <h1><?php echo esc_html_e( 'About', 'gamipress' ); ?></h1>
183
184 <div id="postbox-container-1" class="postbox-container">
185 <div id="normal-sortables" class="meta-box-sortables ui-sortable">
186
187 <?php // Plugins ?>
188 <?php gamipress_dashboard_box( array(
189 'id' => 'plugins',
190 'title' => __( 'Our Plugins', 'gamipress' ),
191 'content_cb' => 'gamipress_dashboard_plugins_box',
192 ) ); ?>
193
194 </div>
195 </div>
196
197 <div id="postbox-container-2" class="postbox-container">
198 <div id="normal-sortables" class="meta-box-sortables ui-sortable">
199
200 <?php // Team ?>
201 <?php gamipress_dashboard_box( array(
202 'id' => 'team',
203 'title' => __( 'Meet the team', 'gamipress' ),
204 'content_cb' => 'gamipress_dashboard_team_box',
205 ) ); ?>
206
207 </div>
208 </div>
209
210 <div id="postbox-container-3" class="postbox-container">
211 <div id="normal-sortables" class="meta-box-sortables ui-sortable">
212
213 <?php // Get involved ?>
214 <?php gamipress_dashboard_box( array(
215 'id' => 'involved',
216 'title' => __( 'Get involved', 'gamipress' ),
217 'content_cb' => 'gamipress_dashboard_involved_box',
218 ) ); ?>
219
220 </div>
221 </div>
222
223 <div id="postbox-container-4" class="postbox-container">
224 <div id="normal-sortables" class="meta-box-sortables ui-sortable">
225
226 <?php // Social ?>
227 <?php gamipress_dashboard_box( array(
228 'id' => 'social',
229 'title' => __( 'Follow us', 'gamipress' ),
230 'content_cb' => 'gamipress_dashboard_social_box',
231 ) ); ?>
232
233 </div>
234 </div>
235
236 </div>
237 </div>
238
239 </div>
240 <?php
241 }
242
243 /**
244 * Dashboard page
245 *
246 * @since 2.0.0
247 */
248 function gamipress_dashboard_box( $args ) {
249
250 $args = wp_parse_args( $args, array(
251 'id' => '',
252 'title' => '',
253 'content' => '',
254 'content_cb' => '',
255 ) );
256
257 ?>
258 <div id="gamipress-dashboard-<?php echo $args['id']; ?>" class="gamipress-dashboard-box postbox">
259
260 <div class="postbox-header">
261 <h2 class="hndle"><?php echo $args['title']; ?></h2>
262 </div>
263
264 <div class="inside">
265
266 <?php if( is_callable( $args['content_cb'] ) ) {
267 call_user_func( $args['content_cb'] );
268 } else {
269 echo $args['content'];
270 } ?>
271
272 </div>
273
274 </div>
275 <?php
276
277 }
278
279 /**
280 * Dashboard points types box
281 *
282 * @since 2.0.0
283 */
284 function gamipress_dashboard_points_types_box() {
285 $types = gamipress_get_points_types();
286 $count = count( $types );
287
288 if( $count === 0 ) : ?>
289
290 <p><?php esc_html_e( 'Points acts as a digital wallet for users. They can collect points while interacting with your site, then use them in different ways.', 'gamipress' ); ?></p>
291
292 <br>
293
294 <div class="center">
295 <a href="<?php echo admin_url( 'post-new.php?post_type=points-type' ); ?>" class="button button-primary"><?php esc_html_e( 'Create your first points type', 'gamipress' ); ?></a>
296 </div>
297
298 <?php else : ?>
299
300 <div id="gamipress-registered-points" class="gamipress-registered-points">
301 <ul>
302 <?php foreach( $types as $slug => $args ) : ?>
303 <li>
304 <a href="<?php echo get_edit_post_link( $args['ID'] ); ?>">
305 <span><?php echo esc_html( $args['plural_name'] ); ?></span>
306 <span><?php printf( esc_html__( '%d Awarded', 'gamipress' ), gamipress_get_earnings_points_sum( array( 'points_type' => $slug, 'points' => 0, 'points_compare' => '>' ) ) ); ?></span>
307 <span><?php printf( esc_html__( '%d Deducted', 'gamipress' ), gamipress_get_earnings_points_sum( array( 'points_type' => $slug, 'points' => 0, 'points_compare' => '<' ) ) ); ?></span>
308 </a>
309 </li>
310 <?php endforeach; ?>
311 </ul>
312 </div>
313
314 <?php endif;
315 }
316
317 /**
318 * Dashboard achievement types box
319 *
320 * @since 2.0.0
321 */
322 function gamipress_dashboard_achievement_types_box() {
323
324 $types = gamipress_get_achievement_types();
325 $count = count( $types );
326
327 if( $count === 0 ) : ?>
328
329 <p><?php esc_html_e( 'Users can acquire achievements by completing the configured requirements. This reward often takes the form of "badges" or "stickers" that users can display on their profiles.', 'gamipress' ); ?></p>
330
331 <br>
332
333 <div class="center">
334 <a href="<?php echo admin_url( 'post-new.php?post_type=achievement-type' ); ?>" class="button button-primary"><?php esc_html_e( 'Create your first achievement type', 'gamipress' ); ?></a>
335 </div>
336
337 <?php else : ?>
338
339 <div id="gamipress-registered-achievements" class="gamipress-registered-achievements">
340 <ul>
341 <?php foreach( $types as $slug => $args ) : ?>
342 <?php $type_count = wp_count_posts( $slug ); ?>
343 <li>
344 <a href="<?php echo admin_url( 'edit.php?post_type=' . $slug ); ?>">
345 <span><?php printf( _n( '%d ' . $args['singular_name'], '%d ' . $args['plural_name'], $type_count->publish ), $type_count->publish ); ?></span>
346 <span><?php printf( esc_html__( '%d Awarded', 'gamipress' ), gamipress_get_earnings_count( array( 'post_type' => $slug ) ) ); ?></span>
347 <span></span>
348 </a>
349 </li>
350 <?php endforeach; ?>
351 </ul>
352 </div>
353 <?php endif;
354 }
355
356 /**
357 * Dashboard rank types box
358 *
359 * @since 2.0.0
360 */
361 function gamipress_dashboard_rank_types_box() {
362
363 $types = gamipress_get_rank_types();
364 $count = count( $types );
365
366 if( $count === 0 ) : ?>
367
368 <p><?php esc_html_e( 'Similar to achievements, ranks are awarded when users complete certain tasks. However, in this case, the criteria must be met in a specific order.', 'gamipress' ); ?></p>
369
370 <br>
371
372 <div class="center">
373 <a href="<?php echo admin_url( 'post-new.php?post_type=rank-type' ); ?>" class="button button-primary"><?php esc_html_e( 'Create your first rank type', 'gamipress' ); ?></a>
374 </div>
375
376 <?php else : ?>
377
378 <div id="gamipress-registered-ranks" class="gamipress-registered-ranks">
379 <ul>
380 <?php foreach( $types as $slug => $args ) : ?>
381 <?php $type_count = wp_count_posts( $slug ); ?>
382 <li>
383 <a href="<?php echo admin_url( 'edit.php?post_type=' . $slug ); ?>">
384 <span><?php printf( _n( '%d ' . $args['singular_name'], '%d ' . $args['plural_name'], $type_count->publish ), $type_count->publish ); ?></span>
385 <span><?php printf( esc_html__( '%d Awarded', 'gamipress' ), gamipress_get_earnings_count( array( 'post_type' => $slug ) ) ); ?></span>
386 <span></span>
387 </a>
388 </li>
389 <?php endforeach; ?>
390 </ul>
391 </div>
392 <?php endif;
393
394 }
395
396
397 /**
398 * Dashboard earnings box
399 *
400 * @since 2.0.0
401 */
402 function gamipress_dashboard_user_earnings_box() {
403 // Setup table
404 ct_setup_table( 'gamipress_user_earnings' );
405
406 $query = new CT_Query( array(
407 'orderby' => 'date',
408 'order' => 'DESC',
409 'items_per_page' => 5,
410 'no_found_rows' => true,
411 'cache_results' => false,
412 ) );
413
414 $user_earnings = $query->get_results();
415
416 if ( count( $user_earnings ) > 0 ) {
417
418 echo '<div id="gamipress-latest-earnings" class="gamipress-latest-earnings">';
419
420 echo '<ul>';
421
422 $today = date( 'Y-m-d', current_time( 'timestamp' ) );
423 $yesterday = date( 'Y-m-d', strtotime( '-1 day', current_time( 'timestamp' ) ) );
424
425 foreach ( $user_earnings as $user_earning ) {
426
427 $time = strtotime( $user_earning->date );
428
429 if ( date( 'Y-m-d', $time ) === $today ) {
430 $relative = __( 'Today', 'gamipress' );
431 } elseif ( date( 'Y-m-d', $time ) === $yesterday ) {
432 $relative = __( 'Yesterday', 'gamipress' );
433 } elseif ( date( 'Y', $time ) !== date( 'Y', current_time( 'timestamp' ) ) ) {
434 /* translators: date and time format for recent posts on the dashboard, from a different calendar year, see https://secure.php.net/date */
435 $relative = date_i18n( __( 'M jS Y' ), $time );
436 } else {
437 /* translators: date and time format for recent posts on the dashboard, see https://secure.php.net/date */
438 $relative = date_i18n( __( 'M jS' ), $time );
439 }
440
441 $user = get_userdata( $user_earning->user_id );
442
443 $user_display_name = $user->display_name;
444
445 if( current_user_can( 'edit_users' ) ) {
446 $user_display_name = '<a href="' . get_edit_user_link( $user_earning->user_id ) . '">' . $user_display_name . '</a>';
447 }
448
449 $user_earning_title = '<strong>' . $user_earning->title . '</strong>';
450
451 $date = sprintf( _x( '%1$s, %2$s', 'dashboard' ), $relative, mysql2date( get_option( 'time_format' ), $user_earning->date ) );
452
453 // translators: %1$s: Username %2$s: Reward
454 $label = sprintf( __( '%1$s got %2$s', 'gamipress' ),
455 $user_display_name,
456 $user_earning_title
457 );
458
459 echo '<li>' . $label . '<span>' . $date . '</span>' . '</li>';
460 }
461
462 echo '</ul>';
463 echo '</div>';
464
465 } else {
466 echo '<p>' . __( 'Nothing to show :)', 'gamipress' ) .'</p>';
467 }
468 }
469
470 /**
471 * Dashboard welcome box
472 *
473 * @since 2.0.0
474 */
475 function gamipress_dashboard_videos_box() {
476 ?>
477 <div class="gamipress-dashboard-columns">
478
479 <div class="gamipress-dashboard-column gamipress-dashboard-main-video">
480 <iframe width="560" height="315" src="https://www.youtube.com/embed/sinW2JjxsdA" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
481 </div>
482
483 <div class="gamipress-dashboard-column gamipress-dashboard-videos-list">
484 <div class="gamipress-dashboard-videos">
485 <?php
486 $videos = array(
487 array(
488 'id' => '-UdktkgGfaU',
489 'title' => __( 'Creating a points type', 'gamipress' ),
490 'duration' => '2:14',
491 ),
492 array(
493 'id' => 'W52HxozyN5g',
494 'title' => __( 'Creating an achievement type', 'gamipress' ),
495 'duration' => '3:32',
496 ),
497 array(
498 'id' => 'oh3MFdAy_xc',
499 'title' => __( 'Creating a rank type', 'gamipress' ),
500 'duration' => '3:58',
501 ),
502 array(
503 'id' => 'JInrhMLQ7aw',
504 'title' => __( 'Unlock achievements and ranks by expending points', 'gamipress' ),
505 'duration' => '1:51',
506 ),
507 array(
508 'id' => 'IW9ZcGaWDBM',
509 'title' => __( 'Award your users through button clicks', 'gamipress' ),
510 'duration' => '1:48',
511 ),
512 );
513
514 foreach( $videos as $video ) { ?>
515 <div class="gamipress-dashboard-video">
516 <a href="https://www.youtube.com/watch?v=<?php echo $video['id']; ?>" target="_blank">
517 <div class="gamipress-dashboard-video-image">
518 <img src="https://img.youtube.com/vi/<?php echo $video['id']; ?>/default.jpg" alt="">
519 </div>
520 <div class="gamipress-dashboard-video-details">
521 <strong class="gamipress-dashboard-video-title"><?php echo $video['title']; ?></strong>
522 <div class="gamipress-dashboard-video-duration"><?php echo $video['duration']; ?></div>
523 </div>
524 </a>
525 </div>
526 <?php }
527
528 ?>
529 </div>
530 <div class="gamipress-dashboard-more-videos">
531 <a href="https://www.youtube.com/channel/UC292zdjiKv6C2u3sBOdSNhg/videos" target="_blank"><?php esc_html_e( 'View all videos', 'gamipress' ); ?></a>
532 </div>
533 </div>
534
535 <div class="gamipress-dashboard-column gamipress-dashboard-videos-list">
536 <div class="gamipress-dashboard-videos">
537 <?php
538 $videos = array(
539 array(
540 'id' => 'BQFBHpGZkmw',
541 'title' => __( 'Manually update user points balance', 'gamipress' ),
542 'duration' => '0:43',
543 ),
544 array(
545 'id' => 'MDQGiK3CT0w',
546 'title' => __( 'Manually award or revoke user achievements', 'gamipress' ),
547 'duration' => '0:52',
548 ),
549 array(
550 'id' => '3_SZfSyE2_E',
551 'title' => __( 'Manually set user rank', 'gamipress' ),
552 'duration' => '0:47',
553 ),
554 array(
555 'id' => 'AG-f0Uv5_WM',
556 'title' => __( 'Award your users through YouTube videos', 'gamipress' ),
557 'duration' => '1:22',
558 ),
559 array(
560 'id' => 'pijaOYc9nLo',
561 'title' => __( 'Award your users through Vimeo videos', 'gamipress' ),
562 'duration' => '1:17',
563 ),
564 );
565
566 foreach( $videos as $video ) { ?>
567 <div class="gamipress-dashboard-video">
568 <a href="https://www.youtube.com/watch?v=<?php echo $video['id']; ?>" target="_blank">
569 <div class="gamipress-dashboard-video-image">
570 <img src="https://img.youtube.com/vi/<?php echo $video['id']; ?>/default.jpg" alt="">
571 </div>
572 <div class="gamipress-dashboard-video-details">
573 <strong class="gamipress-dashboard-video-title"><?php echo $video['title']; ?></strong>
574 <div class="gamipress-dashboard-video-duration"><?php echo $video['duration']; ?></div>
575 </div>
576 </a>
577 </div>
578 <?php }
579
580 ?>
581 </div>
582 </div>
583
584 </div>
585 <?php
586 }
587
588 /**
589 * Dashboard plugin card
590 *
591 * @since 2.0.0
592 */
593 function gamipress_dashboard_render_plugin_card( $plugin ) {
594
595 $details_link = 'https://gamipress.com/add-ons/' . $plugin->info->slug;
596
597 $action_label = ( gamipress_is_plugin_asset( $plugin ) ) ? esc_html__( 'Get this asset', 'gamipress' ) : esc_html__( 'Get this add-on', 'gamipress' );
598
599 ?>
600
601 <div class="gamipress-plugin-card plugin-card plugin-card-<?php echo sanitize_html_class( $plugin->info->slug ); ?>">
602
603 <div class="plugin-card-top cmb-tooltip">
604
605 <div class="thumbnail column-thumbnail">
606 <a href="<?php echo esc_url( $details_link ); ?>" class="open-plugin-details-modal" target="_blank">
607 <img src="<?php echo esc_attr( $plugin->info->thumbnail ) ?>" class="plugin-thumbnail" alt="">
608 </a>
609 </div>
610
611 <div class="name column-name">
612 <h3>
613 <a href="<?php echo esc_url( $details_link ); ?>" class="open-plugin-details-modal" target="_blank">
614 <?php echo $plugin->info->title; ?>
615 </a>
616 </h3>
617 </div>
618
619 <div class="desc column-description cmb-tooltip-desc cmb-tooltip-top">
620 <p><?php echo gamipress_esc_plugin_excerpt( $plugin->info->excerpt ); ?></p>
621 </div>
622
623 </div>
624
625 </div>
626
627 <?php
628
629 }
630
631 /**
632 * Dashboard add-ons section
633 *
634 * @since 2.0.0
635 */
636 function gamipress_dashboard_add_ons_section() {
637
638 $plugins = gamipress_plugins_api();
639
640 if ( is_wp_error( $plugins ) ) {
641 return;
642 }
643
644 $add_ons_to_display = array(
645 'gamipress-leaderboards',
646 'gamipress-notifications',
647 'gamipress-referrals',
648 'gamipress-progress',
649 'gamipress-restrict-content',
650 'gamipress-points-cards',
651 'gamipress-birthdays',
652 );
653
654 $add_ons = array();
655
656 foreach( $plugins as $plugin ) {
657
658 if( in_array( $plugin->info->slug, $add_ons_to_display ) ) {
659 $add_ons[] = $plugin;
660 }
661
662 }
663
664 ?>
665
666 <?php // Add-ons ?>
667 <h1><?php echo esc_html_e( 'Add-ons', 'gamipress' ); ?></h1>
668 <p class="gamipress-section-desc"><?php esc_html_e( 'Pro add-ons help to maintain GamiPress and offer the most advanced features.', 'gamipress' ); ?></p>
669
670 <div id="normal-sortables" class="meta-box-sortables ui-sortable gamipress-dashboard-add-ons-section">
671 <?php foreach( $add_ons as $add_on )
672 gamipress_dashboard_render_plugin_card( $add_on ); ?>
673
674 <div class="gamipress-dashboard-more-add-ons">
675 <a href="<?php echo admin_url( 'admin.php?page=gamipress_add_ons' ); ?>" target="_blank"><?php esc_html_e( 'View all add-ons', 'gamipress' ); ?></a>
676 </div>
677 </div>
678
679 <?php
680
681 }
682
683 /**
684 * Dashboard assets section
685 *
686 * @since 2.0.0
687 */
688 function gamipress_dashboard_assets_section() {
689
690 $plugins = gamipress_plugins_api();
691
692 if ( is_wp_error( $plugins ) ) {
693 return;
694 }
695
696 $add_ons_to_display = array(
697 'gradient-shields',
698 'star-badges',
699 'trophy-icons',
700 'sticker-icons',
701 'flat-badges',
702 'learning-icons',
703 'points-types-icons',
704 );
705
706 $add_ons = array();
707
708 foreach( $plugins as $plugin ) {
709
710 if( in_array( $plugin->info->slug, $add_ons_to_display ) ) {
711 $add_ons[] = $plugin;
712 }
713
714 }
715
716 ?>
717
718 <?php // Add-ons ?>
719 <h1><?php echo esc_html_e( 'Assets', 'gamipress' ); ?></h1>
720 <p class="gamipress-section-desc"><?php esc_html_e( 'Resources to decorate your gamification elements and take their design to the next level!', 'gamipress' ); ?></p>
721
722 <div id="normal-sortables" class="meta-box-sortables ui-sortable gamipress-dashboard-assets-section">
723 <?php foreach( $add_ons as $add_on )
724 gamipress_dashboard_render_plugin_card( $add_on ); ?>
725
726 <div class="gamipress-dashboard-more-add-ons">
727 <a href="<?php echo admin_url( 'admin.php?page=gamipress_assets' ); ?>" target="_blank"><?php esc_html_e( 'View all assets', 'gamipress' ); ?></a>
728 </div>
729 </div>
730
731 <?php
732
733 }
734
735 /**
736 * Dashboard getting started docs box
737 *
738 * @since 2.0.0
739 */
740 function gamipress_dashboard_getting_started_docs_box() {
741 ?>
742 <ul>
743 <li><a href="https://gamipress.com/docs/getting-started/what-is-gamipress/" target="_blank"><?php esc_html_e( 'What is GamiPress?', 'gamipress' ); ?></a></li>
744 <li><a href="https://gamipress.com/docs/getting-started/glossary/" target="_blank"><?php esc_html_e( 'Glossary', 'gamipress' ); ?></a></li>
745 <hr>
746 <li><a href="https://gamipress.com/docs/getting-started/points-types/" target="_blank"><?php esc_html_e( 'Points Types', 'gamipress' ); ?></a></li>
747 <li><a href="https://gamipress.com/docs/getting-started/points-awards-and-deducts/" target="_blank"><?php esc_html_e( 'Points Awards and Deducts', 'gamipress' ); ?></a></li>
748 <li><a href="https://gamipress.com/docs/getting-started/manually-update-user-points-balance/" target="_blank"><?php esc_html_e( 'Manually update user points balance', 'gamipress' ); ?></a></li>
749 <hr>
750 <li><a href="https://gamipress.com/docs/getting-started/achievement-types/" target="_blank"><?php esc_html_e( 'Achievement Types', 'gamipress' ); ?></a></li>
751 <li><a href="https://gamipress.com/docs/getting-started/achievements/" target="_blank"><?php esc_html_e( 'Achievements', 'gamipress' ); ?></a></li>
752 <li><a href="https://gamipress.com/docs/getting-started/steps/" target="_blank"><?php esc_html_e( 'Steps', 'gamipress' ); ?></a></li>
753 <li><a href="https://gamipress.com/docs/getting-started/manually-award-or-revoke-user-achievements/" target="_blank"><?php esc_html_e( 'Manually award or revoke user achievements', 'gamipress' ); ?></a></li>
754 <hr>
755 <li><a href="https://gamipress.com/docs/getting-started/rank-types/" target="_blank"><?php esc_html_e( 'Rank Types', 'gamipress' ); ?></a></li>
756 <li><a href="https://gamipress.com/docs/getting-started/ranks/" target="_blank"><?php esc_html_e( 'Ranks', 'gamipress' ); ?></a></li>
757 <li><a href="https://gamipress.com/docs/getting-started/rank-requirements/" target="_blank"><?php esc_html_e( 'Rank Requirements', 'gamipress' ); ?></a></li><li><a href="https://gamipress.com/docs/getting-started/manually-set-user-rank/" target="_blank"><?php esc_html_e( 'Manually set user rank', 'gamipress' ); ?></a></li>
758 <hr>
759 <li><a href="https://gamipress.com/docs/getting-started/requirements-ui/" target="_blank"><?php esc_html_e( 'Requirements UI', 'gamipress' ); ?></a></li>
760 <li><a href="https://gamipress.com/docs/getting-started/events/" target="_blank"><?php esc_html_e( 'Events', 'gamipress' ); ?></a></li>
761 </ul>
762 <?php
763 }
764
765 /**
766 * Dashboard features docs box
767 *
768 * @since 2.0.0
769 */
770 function gamipress_dashboard_features_docs_box() {
771 ?>
772 <ul>
773 <li><a href="https://gamipress.com/docs/features/ai-assistant/" target="_blank"><?php esc_html_e( 'AI Assistant', 'gamipress' ); ?></a></li>
774 <li><a href="https://gamipress.com/docs/features/badge-builder/" target="_blank"><?php esc_html_e( 'Badge Builder', 'gamipress' ); ?></a></li>
775 <li><a href="https://gamipress.com/docs/features/credentials/" target="_blank"><?php esc_html_e( 'Credentials', 'gamipress' ); ?></a></li>
776 </ul>
777 <?php
778 }
779
780 /**
781 * Dashboard tutorials docs box
782 *
783 * @since 2.0.0
784 */
785 function gamipress_dashboard_tutorials_docs_box() {
786 ?>
787 <ul>
788 <li><a href="https://gamipress.com/docs/tutorials/creating-a-points-type/" target="_blank"><?php esc_html_e( 'Creating a Points Type', 'gamiress' ); ?></a></li>
789 <li><a href="https://gamipress.com/docs/tutorials/creating-an-achievement-type/" target="_blank"><?php esc_html_e( 'Creating an Achievement Type', 'gamiress' ); ?></a></li>
790 <li><a href="https://gamipress.com/docs/tutorials/creating-a-rank-type/" target="_blank"><?php esc_html_e( 'Creating a Rank Type', 'gamiress' ); ?></a></li>
791 <li><a href="https://gamipress.com/docs/tutorials/unlock-achievements-and-ranks-by-expending-points/" target="_blank"><?php esc_html_e( 'Unlock achievements and ranks by expending points', 'gamiress' ); ?></a></li>
792 <li><a href="https://gamipress.com/docs/tutorials/how-the-awards-engine-works/" target="_blank"><?php esc_html_e( 'How the awards engine works', 'gamiress' ); ?></a></li>
793 <li><a href="https://gamipress.com/docs/tutorials/create-your-custom-badges-images/" target="_blank"><?php esc_html_e( 'Create your custom badges images', 'gamiress' ); ?></a></li>
794 </ul>
795 <?php
796 }
797
798 /**
799 * Dashboard advanced docs box
800 *
801 * @since 2.0.0
802 */
803 function gamipress_dashboard_advanced_docs_box() {
804 ?>
805 <ul>
806 <li><a href="https://gamipress.com/docs/advanced/template-files/" target="_blank"><?php esc_html_e( 'Template Files', 'gamipress' ); ?></a></li>
807 <li><a href="https://gamipress.com/docs/advanced/gdpr-compliance/" target="_blank"><?php esc_html_e( 'GDPR Compliance', 'gamipress' ); ?></a></li>
808 <li><a href="https://gamipress.com/docs/advanced/multisite/" target="_blank"><?php esc_html_e( 'Multisite', 'gamipress' ); ?></a></li>
809 <li><a href="https://gamipress.com/docs/advanced/rest-api/" target="_blank"><?php esc_html_e( 'Rest API', 'gamipress' ); ?></a></li>
810 <li><a href="https://gamipress.com/docs/advanced/date-fields/" target="_blank"><?php esc_html_e( 'Date Fields', 'gamipress' ); ?></a></li>
811 <li><a href="https://gamipress.com/docs/advanced/database-performance/" target="_blank"><?php esc_html_e( 'Database Performance', 'gamipress' ); ?></a></li>
812 </ul>
813 <?php
814 }
815
816 /**
817 * Dashboard support box
818 *
819 * @since 2.0.0
820 */
821 function gamipress_dashboard_support_box() {
822 ?>
823 <ul>
824 <li><a href="https://gamipress.com/contact-us/" target="_blank"><?php esc_html_e( 'Contact us', 'gamipress' ); ?></a></li>
825 <li><a href="https://wordpress.org/support/plugin/gamipress" target="_blank"><?php esc_html_e( 'Support Forums', 'gamipress' ); ?></a></li>
826 <li><a href="https://gamipress.com/docs/faq/" target="_blank"><?php esc_html_e( 'FAQ', 'gamipress' ); ?></a></li>
827 <li><a href="https://gamipress.com/docs/troubleshooting/" target="_blank"><?php esc_html_e( 'Troubleshooting', 'gamipress' ); ?></a></li>
828 <li><a href="https://gamipress.com/feature-requests/" target="_blank"><?php esc_html_e( 'Feature Requests', 'gamipress' ); ?></a></li>
829 </ul>
830 <?php
831 }
832
833 /**
834 * Dashboard blocks box
835 *
836 * @since 2.0.0
837 */
838 function gamipress_dashboard_blocks_box() {
839 $shortcodes = array(
840 'achievement' => __( 'Single Achievement', 'gamipress' ),
841 'achievements' => __( 'Achievements', 'gamipress' ),
842 'last_achievements_earned' => __( 'Last Achievements Earned', 'gamipress' ),
843 'user_points' => __( 'User Points', 'gamipress' ),
844 'site_points' => __( 'Site Points', 'gamipress' ),
845 'points_types' => __( 'Points Types', 'gamipress' ),
846 'rank' => __( 'Single Rank', 'gamipress' ),
847 'ranks' => __( 'Ranks', 'gamipress' ),
848 'user_rank' => __( 'User Rank', 'gamipress' ),
849 'inline_achievement' => __( 'Inline Achievement', 'gamipress' ),
850 'inline_last_achievements_earned' => __( 'Inline Last Achievs. Earned', 'gamipress' ),
851 'inline_rank' => __( 'Inline Rank', 'gamipress' ),
852 'inline_user_rank' => __( 'Inline User Rank', 'gamipress' ),
853 'logs' => __( 'Logs', 'gamipress' ),
854 'user_earnings' => __( 'User Earnings', 'gamipress' ),
855 'email_settings' => __( 'Email Settings', 'gamipress' ),
856 );
857 ?>
858 <ul class="gamipress-dashboard-blocks-list">
859 <?php foreach( $shortcodes as $slug => $label ) : ?>
860 <li><?php echo $label; ?>: <span>
861 <a href="https://gamipress.com/docs/blocks/<?php echo str_replace( '_', '-', $slug ); ?>/" target="_blank"><?php esc_html_e( 'Block', 'gamipress' ); ?></a>
862 | <a href="https://gamipress.com/docs/shortcodes/gamipress_<?php echo $slug; ?>/" target="_blank"><?php esc_html_e( 'Shortcode', 'gamipress' ); ?></a>
863 | <a href="https://gamipress.com/docs/widgets/<?php echo str_replace( '_', '-', $slug ); ?>/" target="_blank"><?php esc_html_e( 'Widget', 'gamipress' ); ?></a>
864 </span></li>
865 <?php endforeach; ?>
866 </ul>
867 <?php
868 }
869
870 /**
871 * Dashboard plugins box
872 *
873 * @since 2.0.0
874 */
875 function gamipress_dashboard_plugins_box() {
876 $url = GAMIPRESS_URL . 'assets/img/logos/';
877 ?>
878 <ul id="our-plugins-list" class="our-plugins-list">
879 <li>
880 <a href="https://wordpress.org/plugins/gamipress/" target="_blank">
881 <img src="<?php echo esc_attr( $url . 'gamipress.svg' ); ?>" class="our-plugins-img our-plugins-gamipress" loading="lazy">
882 <span>GamiPress</span>
883 </a>
884 </li>
885 <li>
886 <a href="https://wordpress.org/plugins/automatorwp/" target="_blank">
887 <img src="<?php echo esc_attr( $url . 'automatorwp.svg' ); ?>" class="our-plugins-img our-plugins-automatorwp" loading="lazy">
888 <span>AutomatorWP</span>
889 </a>
890 </li>
891 <li>
892 <a href="https://wordpress.org/plugins/shortlinkspro/" target="_blank">
893 <img src="<?php echo esc_attr( $url . 'shortlinkspro.svg' ); ?>" class="our-plugins-img our-plugins-shortlinkspro" loading="lazy">
894 <span>ShortLinks Pro</span>
895 </a>
896 </li>
897 <li>
898 <a href="https://wordpress.org/plugins/bbforms/" target="_blank">
899 <img src="<?php echo esc_attr( $url . 'bbforms.svg' ); ?>" class="our-plugins-img our-plugins-bbforms" loading="lazy">
900 <span>BBForms</span>
901 </a>
902 </li>
903 </ul>
904 <?php
905 }
906
907 /**
908 * Dashboard team box
909 *
910 * @since 2.0.0
911 */
912 function gamipress_dashboard_team_box() {
913 ?>
914 <ul id="contributors-list" class="contributors-list">
915 <li class="cmb-tooltip cmb-tooltip-no-opacity">
916 <a href="https://profiles.wordpress.org/rubengc/" target="_blank">
917 <img src="https://secure.gravatar.com/avatar/103d0ec19ade3804009f105974fd4d05?s=64&amp;d=mm&amp;r=g" class="avatar avatar-32 photo" loading="lazy">
918 <span class="cmb-tooltip-desc cmb-tooltip-top center">Ruben Garcia</span>
919 </a>
920 </li>
921 <li class="cmb-tooltip cmb-tooltip-no-opacity">
922 <a href="https://profiles.wordpress.org/eneribs/" target="_blank">
923 <img src="https://secure.gravatar.com/avatar/7103ea44d40111ab67a22efe7ebd6f71?s=64&amp;d=mm&amp;r=g" class="avatar avatar-32 photo" loading="lazy">
924 <span class="cmb-tooltip-desc cmb-tooltip-top center">Irene Berna</span>
925 </a>
926 </li>
927 <li class="cmb-tooltip cmb-tooltip-no-opacity">
928 <a href="https://profiles.wordpress.org/dioni00/" target="_blank">
929 <img src="https://secure.gravatar.com/avatar/6de68ad3863fdf3c92a194ba16546571?s=64&amp;d=mm&amp;r=g" class="avatar avatar-32 photo" loading="lazy">
930 <span class="cmb-tooltip-desc cmb-tooltip-top center">Dionisio Sanchez</span>
931 </a>
932 </li>
933 <li class="cmb-tooltip cmb-tooltip-no-opacity">
934 <a href="https://profiles.wordpress.org/tinocalvo/" target="_blank">
935 <img src="https://secure.gravatar.com/avatar/a438aa12efcfb007f3db145d6ad37def?s=64&amp;d=retro&amp;r=g" class="avatar avatar-32 photo" loading="lazy">
936 <span class="cmb-tooltip-desc cmb-tooltip-top center">Tino Calvo</span>
937 </a>
938 </li>
939 <li class="cmb-tooltip cmb-tooltip-no-opacity">
940 <a href="https://profiles.wordpress.org/pacogon/" target="_blank">
941 <img src="https://secure.gravatar.com/avatar/348f374779e7433ad6bf3930cb2a492e?s=64&amp;d=mm&amp;r=g" class="avatar avatar-32 photo" loading="lazy">
942 <span class="cmb-tooltip-desc cmb-tooltip-top center">Paco González</span>
943 </a>
944 </li>
945 <li class="cmb-tooltip cmb-tooltip-no-opacity">
946 <a href="https://profiles.wordpress.org/flabernardez/" target="_blank">
947 <img src="https://secure.gravatar.com/avatar/fd626d9a8463260894f0f6f07a5cc71a?s=64&amp;d=mm&amp;r=g" class="avatar avatar-32 photo" loading="lazy">
948 <span class="cmb-tooltip-desc cmb-tooltip-top center">Flavia Bernardez</span>
949 </a>
950 </li>
951 </ul>
952 <?php
953 }
954
955 /**
956 * Dashboard social box
957 *
958 * @since 2.0.0
959 */
960 function gamipress_dashboard_social_box() {
961 ?>
962 <ul class="gamipress-dashboard-social-list">
963 <li class="cmb-tooltip cmb-tooltip-no-opacity">
964 <a href="https://www.youtube.com/channel/UC292zdjiKv6C2u3sBOdSNhg" target="_blank"><i class="dashicons dashicons-youtube"></i></a>
965 <span class="cmb-tooltip-desc cmb-tooltip-top center"><?php esc_html_e( 'Subscribe to our YouTube channel', 'gamipress' ); ?></span>
966 </li>
967 <li class="cmb-tooltip cmb-tooltip-no-opacity">
968 <a href="https://www.facebook.com/GamiPress/" target="_blank"><i class="dashicons dashicons-facebook-alt"></i></a>
969 <span class="cmb-tooltip-desc cmb-tooltip-top center"><?php esc_html_e( 'Follow us on Facebook', 'gamipress' ); ?></span>
970 </li>
971 <li class="cmb-tooltip cmb-tooltip-no-opacity">
972 <a href="https://www.facebook.com/groups/gamipress" target="_blank"><i class="dashicons dashicons-groups"></i></a>
973 <span class="cmb-tooltip-desc cmb-tooltip-top center"><?php esc_html_e( 'Join our Facebook community', 'gamipress' ); ?></span>
974 </li>
975 <li class="cmb-tooltip cmb-tooltip-no-opacity">
976 <a href="https://twitter.com/GamiPress" target="_blank"><i class="dashicons dashicons-twitter"></i></a>
977 <span class="cmb-tooltip-desc cmb-tooltip-top center"><?php esc_html_e( 'Follow @GamiPress on Twitter', 'gamipress' ); ?></span>
978 </li>
979 <li class="cmb-tooltip cmb-tooltip-no-opacity">
980 <a href="https://www.linkedin.com/company/28389774/" target="_blank"><i class="dashicons dashicons-linkedin"></i></a>
981 <span class="cmb-tooltip-desc cmb-tooltip-top center"><?php esc_html_e( 'Follow us on LinkedIn', 'gamipress' ); ?></span>
982 </li>
983 </ul>
984
985 <h3><?php esc_html_e( 'Contact us', 'gamipress' ); ?></h3>
986 <ul class="gamipress-dashboard-social-list">
987 <li class="cmb-tooltip cmb-tooltip-no-opacity">
988 <a href="https://wordpress.org/support/plugin/gamipress/" target="_blank"><i class="dashicons dashicons-wordpress"></i></a>
989 <span class="cmb-tooltip-desc cmb-tooltip-top center"><?php esc_html_e( 'Support Forums', 'gamipress' ); ?></span>
990 </li>
991 <li class="cmb-tooltip cmb-tooltip-no-opacity">
992 <a href="https://gamipress.com/contact-us/" target="_blank"><i class="dashicons dashicons-email-alt"></i></a>
993 <span class="cmb-tooltip-desc cmb-tooltip-top center"><?php esc_html_e( 'Open a support ticket', 'gamipress' ); ?></span>
994 </li>
995 </ul>
996 <?php
997 }
998
999 /**
1000 * Dashboard involved box
1001 *
1002 * @since 2.0.0
1003 */
1004 function gamipress_dashboard_involved_box() {
1005 ?>
1006 <p><?php esc_html_e( 'GamiPress is a free and open-source plugin accessible to everyone just like WordPress. There are many ways you can help support GamiPress', 'gamipress' ); ?></p>
1007 <ul>
1008 <li><a href="https://translate.wordpress.org/projects/wp-plugins/gamipress/" target="_blank"><i class="dashicons dashicons-translation"></i> <?php esc_html_e( 'Translate GamiPress into your language.', 'gamipress' ); ?></a></li>
1009 <li><a href="https://wordpress.org/plugins/gamipress/#reviews" target="_blank"><i class="dashicons dashicons-wordpress"></i> <?php esc_html_e( 'Review GamiPress on WordPress.org.', 'gamipress' ); ?></a></li>
1010 </ul>
1011 <?php
1012 }