Viewing 6 replies - 1 through 6 (of 6 total)
  • Michael Beckwith

    (@tw2113)

    The BenchPresser

    We have this issue created already https://github.com/opencredit/badgeos/issues/52 but that doesn’t make it implemented already yet. However it is a known request.

    If you want and know how to, all of the achievements are posts/post meta so WP_Query would be optimal for something like this for crafting your own until then.

    I have created my own shortcode for this. Not sure if this has been resolved but I can supply mine if that is helpful.

    should have just posted this before! Hope it helps someone.
    I’m very much a novice but this works for me. I made my own plugin folder to put this and others I experiment with….

    function badgeos_get_users_points_shortcode( $user_id = 0 ) {

    // Use current user’s ID if none specified
    if ( ! $user_id )
    $user_id = wp_get_current_user()->ID;

    // Return our user’s points as an integer (sanely falls back to 0 if empty)
    return absint( get_user_meta( $user_id, ‘_badgeos_points’, true ) );
    }
    add_shortcode( ‘badgeos_get_users_points’, ‘badgeos_get_users_points_shortcode’ );

    Hi Dylan,
    Thanks for your code!

    I am curious to know how best to define the user id within the shortcode if needed? would something like this work if I wanted to pass the author id?

    echo do_shortcode( '[badgeos_get_current_user_points '.$user_id.'='.$author_id.']' );

    I tried it but it didn’t work so I was thinking to create another shortcode for the authors but then thought I could check here first.

    Thanks!

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    Yeah, given that nature of what’s going on, and how it would affect what the shortcode does, it may be a case of copying/making your own version at the moment.

    Thanks, I made a clone of the code and changed where needed and all is working fine.

    Again, thanks all for the useful codes here and in other posts!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Display points of users’ is closed to new replies.