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/single-achievement.php +21 -6 7.9.7 → 8.0.5 View file →
@@ -9,10 +9,16 @@
9 9
10 10 // Shorthand
11 11 $a = $gamipress_template_args;
12 12
13 +$credential = gamipress_get_the_credential();
14 +
13 15 // Check if user has earned this Achievement, and add an 'earned' class
14 -$earned = gamipress_has_user_earned_achievement( get_the_ID(), get_current_user_id() );
16 +if( $credential ) {
17 + $earned = true;
18 +} else {
19 + $earned = gamipress_has_user_earned_achievement( get_the_ID(), get_current_user_id() );
20 +}
15 21
16 22 // Setup achievement classes
17 23 $classes = array(
18 24 'single-achievement',
@@ -17,8 +23,9 @@
17 23 $classes = array(
18 24 'single-achievement',
19 25 'achievement-wrap',
20 26 ( $earned ? 'user-has-earned' : '' ),
27 + ( $credential ? 'is-credential' : '' ),
21 28 'gamipress-layout-' . $a['layout'],
22 29 'gamipress-align-' . $a['align']
23 30 );
24 31
@@ -32,10 +39,13 @@
32 39 * @param array $template_args Template received arguments
33 40 */
34 41 $classes = apply_filters( 'gamipress_single_achievement_classes', $classes, get_the_ID(), $a ); ?>
35 42
36 -<?php // Check if current user has earned this achievement
37 -echo gamipress_render_earned_achievement_text( get_the_ID(), get_current_user_id() ); ?>
43 +<?php if( $credential ) : ?>
44 + <?php echo gamipress_get_credential_text( $credential ); ?>
45 +<?php else : ?>
46 + <?php echo gamipress_render_earned_achievement_text( get_the_ID(), get_current_user_id() ); ?>
47 +<?php endif; ?>
38 48
39 49 <div class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
40 50
41 51 <?php
@@ -147,10 +157,12 @@
147 157 * @param array $template_args Template received arguments
148 158 */
149 159 do_action( 'gamipress_after_single_achievement_steps', get_the_ID(), $a ); ?>
150 160
151 - <?php // Achievement unlock with points
152 - echo gamipress_achievement_unlock_with_points_markup( get_the_ID(), $a ); ?>
161 + <?php if( ! $credential ) : ?>
162 + <?php // Achievement unlock with points
163 + echo gamipress_achievement_unlock_with_points_markup( get_the_ID(), $a ); ?>
164 + <?php endif; ?>
153 165
154 166 <?php // Include achievement earners, if this achievement supports it
155 167 if ( (bool) gamipress_get_post_meta( get_the_ID(), '_gamipress_show_earners' ) ) :
156 168
@@ -193,5 +205,8 @@
193 205 * @param array $template_args Template received arguments
194 206 */
195 207 do_action( 'gamipress_after_single_achievement', get_the_ID(), $a ); ?>
196 208
197 -</div><!-- .achievement-wrap -->
209 +</div><!-- .achievement-wrap -->
210 +
211 +<?php // Credentials links
212 +echo gamipress_get_credentials_links_html( get_the_ID(), $a ); ?>