PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 8.0.5
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v8.0.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
← All changes | includes/admin/meta-boxes/ranks.php +145 -0 7.9.0 → 8.0.5 View file →
@@ -1,0 +1,145 @@
1 +<?php
2 +/**
3 + * Ranks Meta Boxes
4 + *
5 + * @package GamiPress\Admin\Meta_Boxes\Ranks
6 + * @author GamiPress <[email protected]>, Ruben Garcia <[email protected]>
7 + * @since 1.4.7
8 + */
9 +// Exit if accessed directly
10 +if( !defined( 'ABSPATH' ) ) exit;
11 +
12 +/**
13 + * Register ranks meta boxes
14 + *
15 + * @param string $post_type
16 + *
17 + * @since 1.3.1
18 + */
19 +function gamipress_ranks_meta_boxes( $post_type ) {
20 +
21 + // Start with an underscore to hide fields from custom fields list
22 + $prefix = '_gamipress_';
23 +
24 + // Grab our rank types slugs
25 + $rank_types = gamipress_get_rank_types_slugs();
26 +
27 + if( ! in_array( $post_type, $rank_types ) ) {
28 + return;
29 + }
30 +
31 + // Rank Data
32 + gamipress_add_meta_box(
33 + 'rank-data',
34 + __( 'Rank Data', 'gamipress' ),
35 + $rank_types,
36 + array(
37 + $prefix . 'congratulations_text' => array(
38 + 'name' => __( 'Congratulations Text', 'gamipress' ),
39 + 'tooltip' => __( 'Displayed after rank is reached.', 'gamipress' ),
40 + 'label_cb' => 'cmb_tooltip_label_cb',
41 + 'type' => 'wysiwyg',
42 + ),
43 + $prefix . 'unlock_with_points' => array(
44 + 'name' => __( 'Unlock using points', 'gamipress' ),
45 + 'tooltip' => __( 'Allow users to unlock this rank by expending an amount of points.', 'gamipress' ),
46 + 'label_cb' => 'cmb_tooltip_label_cb',
47 + 'type' => 'checkbox',
48 + 'classes' => 'gamipress-switch'
49 + ),
50 + $prefix . 'points_to_unlock' => array(
51 + 'name' => __( 'Points to Unlock', 'gamipress' ),
52 + 'tooltip' => __( 'Amount of points needed to optionally unlock this rank by expending them.', 'gamipress' ),
53 + 'label_cb' => 'cmb_tooltip_label_cb',
54 + 'type' => 'gamipress_points',
55 + 'points_type_key' => $prefix . 'points_type_to_unlock',
56 + 'default' => '0',
57 + ),
58 + ),
59 + array(
60 + 'context' => 'advanced',
61 + 'priority' => 'high',
62 + )
63 + );
64 +
65 + // Rank Template
66 + gamipress_add_meta_box(
67 + 'rank-template',
68 + __( 'Rank Template', 'gamipress' ),
69 + $rank_types,
70 + array(
71 + $prefix . 'show_earners' => array(
72 + 'name' => __( 'Show Earners', 'gamipress' ),
73 + 'tooltip' => __( 'Display a list of users who have reached this rank.', 'gamipress' ),
74 + 'label_cb' => 'cmb_tooltip_label_cb',
75 + 'type' => 'checkbox',
76 + 'classes' => 'gamipress-switch'
77 + ),
78 + $prefix . 'maximum_earners' => array(
79 + 'name' => __( 'Maximum Earners', 'gamipress' ),
80 + 'tooltip' => __( 'Set the maximum number of earners to show (0 for no maximum).', 'gamipress' ),
81 + 'label_cb' => 'cmb_tooltip_label_cb',
82 + 'type' => 'text',
83 + 'attributes' => array(
84 + 'type' => 'number',
85 + 'step' => '1',
86 + ),
87 + 'default' => '0'
88 + ),
89 + $prefix . 'layout' => array(
90 + 'name' => __( 'Layout', 'gamipress' ),
91 + 'tooltip' => __( 'Layout to show the rank.', 'gamipress' ),
92 + 'label_cb' => 'cmb_tooltip_label_cb',
93 + 'type' => 'radio',
94 + 'options' => gamipress_get_layout_options(),
95 + 'default' => 'left',
96 + 'inline' => true,
97 + 'classes' => 'gamipress-image-options'
98 + ),
99 + $prefix . 'align' => array(
100 + 'name' => __( 'Alignment', 'gamipress' ),
101 + 'tooltip' => __( 'Alignment to show the rank.', 'gamipress' ),
102 + 'label_cb' => 'cmb_tooltip_label_cb',
103 + 'type' => 'radio',
104 + 'options' => gamipress_get_alignment_options(),
105 + 'default' => 'none',
106 + 'inline' => true,
107 + 'classes' => 'gamipress-image-options'
108 + ),
109 + ),
110 + array(
111 + 'context' => 'side',
112 + )
113 + );
114 +
115 + // Rank Details
116 + gamipress_add_meta_box(
117 + 'rank-details',
118 + __( 'Rank Details', 'gamipress' ),
119 + $rank_types,
120 + array(
121 + 'menu_order' => array(
122 + 'name' => __( 'Priority', 'gamipress' ),
123 + 'tooltip' => __( 'The rank priority defines the order a user can achieve ranks. User will need to get lower priority ranks before get this one.', 'gamipress' ),
124 + 'label_cb' => 'cmb_tooltip_label_cb',
125 + 'type' => 'text_medium',
126 + ),
127 + $prefix . 'next_rank' => array(
128 + 'content_cb' => 'gamipress_next_rank_content_cb',
129 + 'type' => 'html',
130 + 'classes' => 'gamipress-no-pad'
131 + ),
132 + $prefix . 'prev_rank' => array(
133 + 'content_cb' => 'gamipress_prev_rank_content_cb',
134 + 'type' => 'html',
135 + 'classes' => 'gamipress-no-pad'
136 + ),
137 + ),
138 + array(
139 + 'context' => 'side',
140 + 'priority' => 'default',
141 + )
142 + );
143 +
144 +}
145 +add_action( 'gamipress_init_meta_boxes', 'gamipress_ranks_meta_boxes' );