| @@ -223,11 +223,16 @@ | ||
| 223 | 223 | $links = ''; |
| 224 | 224 | |
| 225 | 225 | if( ! $credential ) { |
| 226 | 226 | // Links when not viewing a credential |
| 227 | + | |
| 228 | + $user_earning = gamipress_get_last_earning( array( 'post_id' => $post_id, 'user_id' => $user_id ) ); | |
| 229 | + | |
| 230 | + // Only render credential link if user is viewing its own achievement/rank | |
| 227 | 231 | if( $user_id === $viewing_user_id ) { |
| 228 | - // Only render credential link if user is viewing its own achievement/rank | |
| 229 | - $links .= gamipress_get_credential_link( $post_id, $user_id ); | |
| 232 | + // Show credential link if user has earned it | |
| 233 | + if( $user_earning ) | |
| 234 | + $links .= gamipress_get_credential_link( $user_earning ); | |
| 230 | 235 | } |
| 231 | 236 | |
| 232 | 237 | /** |
| 233 | 238 | * Available filter to add credentials links when viewing a post (achievement or rank) |