You can add this shortcode to your theme’s functions.php if you want.
function badgeos_tk_earn_achievement_for_page_view_shortcode( $atts = array() ) {
$atts = shortcode_atts( array(
'achievement_id' => 0,
'user_id' => get_current_user_id()
), $atts );
badgeos_maybe_award_achievement_to_user( $atts['achievement_id'], $atts['user_id'] );
}
add_shortcode( 'badgeos_tk_earn_achievement_for_page_view', 'badgeos_tk_earn_achievement_for_page_view_shortcode' );
you would then have a shortcode available named [badgeos_tk_earn_achievement_for_page_view]
with possible shortcode attributes of achievement_id
an user_id
.
[badgeos_tk_earn_achievement_for_page_view achievement_id="52"]
The example right above would try to award the current user with the achievement whose ID is 52.
Place it on a page/post/wherever you want and it’ll run when the user views that page/post/whatever. If they’ve already earned it, nothing will change. If they haven’t yet, they’ll be awarded it.