PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 7.9.5
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v7.9.5
8.0.5 8.0.4 8.0.3 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 All 47 releases
gamipress / includes / admin / pages / dashboard.php

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

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