| @@ -9,10 +9,12 @@ | ||
| 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 rank, rank is earned by default if is the lowest priority of this type |
| 14 | -if( gamipress_is_lowest_priority_rank( get_the_ID() ) ) { | |
| 16 | +if( $credential || gamipress_is_lowest_priority_rank( get_the_ID() ) ) { | |
| 15 | 17 | $earned = true; |
| 16 | 18 | } else { |
| 17 | 19 | $earned = gamipress_has_user_earned_achievement( get_the_ID(), get_current_user_id() ); |
| 18 | 20 | } |
| @@ -21,8 +23,9 @@ | ||
| 21 | 23 | $classes = array( |
| 22 | 24 | 'single-rank', |
| 23 | 25 | 'rank-wrap', |
| 24 | 26 | ( $earned ? 'user-has-earned' : '' ), |
| 27 | + ( $credential ? 'is-credential' : '' ), | |
| 25 | 28 | 'gamipress-layout-' . $a['layout'], |
| 26 | 29 | 'gamipress-align-' . $a['align'] |
| 27 | 30 | ); |
| 28 | 31 | |
| @@ -36,10 +39,13 @@ | ||
| 36 | 39 | * @param array $template_args Template received arguments |
| 37 | 40 | */ |
| 38 | 41 | $classes = apply_filters( 'gamipress_single_rank_classes', $classes, get_the_ID(), $a ); ?> |
| 39 | 42 | |
| 40 | -<?php // Check if current user has earned this rank | |
| 41 | -echo gamipress_render_earned_rank_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_rank_text( get_the_ID(), get_current_user_id() ); ?> | |
| 47 | +<?php endif; ?> | |
| 42 | 48 | |
| 43 | 49 | <div class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>"> |
| 44 | 50 | |
| 45 | 51 | <?php |
| @@ -56,10 +62,12 @@ | ||
| 56 | 62 | <div class="gamipress-rank-image"> |
| 57 | 63 | <?php // Thumbnail |
| 58 | 64 | echo gamipress_get_rank_post_thumbnail( get_the_ID() ); ?> |
| 59 | 65 | |
| 60 | - <?php // Share | |
| 61 | - echo gamipress_rank_share_markup( get_the_ID(), $a ); ?> | |
| 66 | + <?php if( ! $credential ) : ?> | |
| 67 | + <?php // Share | |
| 68 | + echo gamipress_rank_share_markup( get_the_ID(), $a ); ?> | |
| 69 | + <?php endif; ?> | |
| 62 | 70 | </div> |
| 63 | 71 | |
| 64 | 72 | <?php |
| 65 | 73 | /** |
| @@ -103,10 +111,12 @@ | ||
| 103 | 111 | * @param array $template_args Template received arguments |
| 104 | 112 | */ |
| 105 | 113 | do_action( 'gamipress_after_single_rank_requirements', get_the_ID(), $a ); ?> |
| 106 | 114 | |
| 107 | - <?php // Rank unlock with points | |
| 108 | - echo gamipress_rank_unlock_with_points_markup( get_the_ID(), $a ); ?> | |
| 115 | + <?php if( ! $credential ) : ?> | |
| 116 | + <?php // Rank unlock with points | |
| 117 | + echo gamipress_rank_unlock_with_points_markup( get_the_ID(), $a ); ?> | |
| 118 | + <?php endif; ?> | |
| 109 | 119 | |
| 110 | 120 | <?php // Include rank earners, if this rank supports it |
| 111 | 121 | if ( $show_earners = gamipress_get_post_meta( get_the_ID(), '_gamipress_show_earners' ) ) { |
| 112 | 122 | |
| @@ -149,5 +159,8 @@ | ||
| 149 | 159 | * @param array $template_args Template received arguments |
| 150 | 160 | */ |
| 151 | 161 | do_action( 'gamipress_after_single_rank', get_the_ID(), $a ); ?> |
| 152 | 162 | |
| 153 | -</div><!-- .rank-wrap --> | |
| 163 | +</div><!-- .rank-wrap --> | |
| 164 | + | |
| 165 | +<?php // Credential link | |
| 166 | +echo gamipress_get_credentials_links_html( get_the_ID(), $a ); ?> | |