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 | templates/points.php +193 -0 7.8.9 → 8.0.5 View file →
@@ -1,0 +1,193 @@
1 +<?php
2 +/**
3 + * Points template
4 + *
5 + * This template can be overridden by copying it to yourtheme/gamipress/points.php
6 + * To override a specific points type just copy it as yourtheme/gamipress/points-{points-type}.php
7 + */
8 +global $gamipress_template_args;
9 +
10 +// Shorthand
11 +$a = $gamipress_template_args;
12 +
13 +$points_types = gamipress_get_points_types();
14 +
15 +// Default points type
16 +$points_types[''] = array(
17 + 'singular_name' => __( 'Point', 'gamipress' ),
18 + 'plural_name' => __( 'Points', 'gamipress' )
19 +);
20 +
21 +// Check to meet if points showed comes from current logged in user
22 +$is_current_user = ( absint( $a['user_id'] ) === get_current_user_id() );
23 +
24 +// Setup thumbnail size
25 +$thumbnail_size = absint( $a['thumbnail_size'] );
26 +
27 +if( $thumbnail_size === 0 ) {
28 + $thumbnail_size = 'gamipress-points';
29 +} else {
30 + $thumbnail_size = array( $thumbnail_size, $thumbnail_size );
31 +}
32 +
33 +// Setup points classes
34 +$classes = array(
35 + 'gamipress-user-points',
36 + ( $is_current_user ? 'gamipress-is-current-user' : '' ),
37 + 'gamipress-columns-' . $a['columns'],
38 + 'gamipress-columns-small-' . $a['columns_small'],
39 + 'gamipress-layout-' . $a['layout'],
40 + 'gamipress-align-' . $a['align']
41 +);
42 +
43 +/**
44 + * Points classes
45 + *
46 + * @since 1.4.0
47 + *
48 + * @param array $classes Array of points classes
49 + * @param integer $points_types Array of points types to be rendered
50 + * @param array $template_args Template received arguments
51 + */
52 +$classes = apply_filters( 'gamipress_points_classes', $classes, $points_types, $a ); ?>
53 +
54 +<div class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
55 +
56 + <?php
57 + /**
58 + * Before render user points list
59 + *
60 + * @since 1.0.0
61 + *
62 + * @param array $points_types Array of points types to be rendered
63 + * @param array $template_args Template received arguments
64 + */
65 + do_action( 'gamipress_before_render_points_list', $points_types, $a ); ?>
66 +
67 + <?php foreach( $a['points'] as $points_type => $amount ) :
68 +
69 + $label_position = gamipress_get_points_type_label_position( $points_type ); ?>
70 +
71 + <?php
72 + /**
73 + * Before render user points
74 + *
75 + * @since 1.0.0
76 + *
77 + * @param string $points_type Points type slug
78 + * @param integer $amount Amount of this points type
79 + * @param array $points_types Array of points types to be rendered
80 + * @param array $template_args Template received arguments
81 + */
82 + do_action( 'gamipress_before_render_points', $points_type, $amount, $points_types, $a ); ?>
83 +
84 + <div class="gamipress-points gamipress-user-points-<?php echo esc_attr( $points_type ); ?>">
85 +
86 + <?php // User Points Image
87 + if( $a['thumbnail'] === 'yes' ) : ?>
88 + <div class="gamipress-user-points-image gamipress-user-points-<?php echo esc_attr( $points_type ); ?>-image">
89 + <?php echo gamipress_get_points_type_thumbnail( $points_type, $thumbnail_size ); ?>
90 + </div><!-- .gamipress-user-points-image -->
91 +
92 + <?php
93 + /**
94 + * After user points thumbnail
95 + *
96 + * @since 1.0.0
97 + *
98 + * @param string $points_type Points type slug
99 + * @param integer $amount Amount of this points type
100 + * @param array $points_types Array of points types to be rendered
101 + * @param array $template_args Template received arguments
102 + */
103 + do_action( 'gamipress_after_user_points_thumbnail', $points_type, $amount, $points_types, $a ); ?>
104 +
105 + <?php endif; ?>
106 +
107 + <div class="gamipress-user-points-description">
108 +
109 + <?php // User Points Label (before)
110 + if( $a['label'] === 'yes' && $label_position === 'before' ) : ?>
111 + <span class="gamipress-user-points-label"><?php echo gamipress_get_points_amount_label( $amount, $points_type ); ?></span>
112 +
113 + <?php
114 + /**
115 + * After user points label
116 + *
117 + * @since 1.0.0
118 + *
119 + * @param string $points_type Points type slug
120 + * @param integer $amount Amount of this points type
121 + * @param array $points_types Array of points types to be rendered
122 + * @param array $template_args Template received arguments
123 + */
124 + do_action( 'gamipress_after_user_points_label', $points_type, $amount, $points_types, $a ); ?>
125 +
126 + <?php endif; ?>
127 +
128 + <span class="gamipress-user-points-amount"><?php echo gamipress_format_amount( $amount, $points_type ); ?></span>
129 +
130 + <?php
131 + /**
132 + * After user points amount
133 + *
134 + * @since 1.0.0
135 + * @updated 1.5.1 Fixed filter name, changed from 'gamipress_after_user_points_count' to 'gamipress_after_user_points_amount'
136 + *
137 + * @param string $points_type Points type slug
138 + * @param integer $amount Amount of this points type
139 + * @param array $points_types Array of points types to be rendered
140 + * @param array $template_args Template received arguments
141 + */
142 + do_action( 'gamipress_after_user_points_amount', $points_type, $amount, $points_types, $a ); ?>
143 +
144 + <?php // User Points Label (after)
145 + if( $a['label'] === 'yes' && $label_position !== 'before' ) : ?>
146 + <span class="gamipress-user-points-label"><?php echo gamipress_get_points_amount_label( $amount, $points_type ); ?></span>
147 +
148 + <?php
149 + /**
150 + * After user points label
151 + *
152 + * @since 1.0.0
153 + *
154 + * @param string $points_type Points type slug
155 + * @param integer $amount Amount of this points type
156 + * @param array $points_types Array of points types to be rendered
157 + * @param array $template_args Template received arguments
158 + */
159 + do_action( 'gamipress_after_user_points_label', $points_type, $amount, $points_types, $a ); ?>
160 +
161 + <?php endif; ?>
162 +
163 + </div><!-- .gamipress-user-points-description -->
164 +
165 + </div><!-- .gamipress-points -->
166 +
167 + <?php
168 + /**
169 + * After render user points
170 + *
171 + * @since 1.0.0
172 + *
173 + * @param string $points_type Points type slug
174 + * @param integer $amount Amount of this points type
175 + * @param array $points_types Array of points types to be rendered
176 + * @param array $template_args Template received arguments
177 + */
178 + do_action( 'gamipress_after_render_points', $points_type, $amount, $points_types, $a ); ?>
179 +
180 + <?php endforeach; ?>
181 +
182 + <?php
183 + /**
184 + * After render user points list
185 + *
186 + * @since 1.0.0
187 + *
188 + * @param array $points_types Array of points types rendered
189 + * @param array $template_args Template received arguments
190 + */
191 + do_action( 'gamipress_after_render_points_list', $points_types, $a ); ?>
192 +
193 +</div><!-- .gamipress-user-points -->