• Just upgraded to latest version and anywhere where I display points, it is showing that the user has 1 point when they have a lot more.

    For example, this is how I display current user’s points:

    <?php echo number_format(mycred_get_users_cred());?>

    Or to show the author’s points:
    <?php echo number_format( mycred_get_users_cred($GLOBALS['post']->post_author) ); ?>

    This simply is not working as it should. What has changed and why is this not functioning as it should? Thank you!

    https://wordpress.org/plugins/mycred/

Viewing 5 replies - 1 through 5 (of 5 total)
  • I’m having the same issue.

    I got around it with this:

    global $mycred;
    $user_ID = get_current_user_id();
    $balance = $mycred->get_users_cred($user_ID);

    and in your case, then:

    <?php echo number_format($balance); ?>

    I have no idea why it’s broken however. Maybe the author could shed some light.

    Thread Starter iamonlythird

    (@iamonlythird)

    Thank you for the response, but your solution is not using the function which should work. I think instead of a workaround like the one you have posted, it would be better to find out why the function itself is not working as it should, or if there is a problem with the code that I posted.

    Is the plugin developer around?

    Plugin Author myCred

    (@designbymerovingi)

    Hey.

    The issue lays in the mycred_get_users_cred function which is not taking into account a point type.

    You could instead of using this function use:

    $user_id = 1;
    
    // you can also use mycred( 'mypointtype' ); for custom point types
    $mycred = mycred();
    $balance = $mycred->get_users_balance( $user_id );
    echo 'Your balance is: ' . $mycred->format_creds( $balance );

    Thread Starter iamonlythird

    (@iamonlythird)

    Thank you. Will the mycred_get_users_cred function work as it should on the next update?

    Plugin Author myCred

    (@designbymerovingi)

    Yes or you can download a fresh copy of 1.4.7 and replace your current version as I have included fixes in this version as well. Simply download a new copy, disable myCRED in your admin area (DO NOT DELETE) and upload the new files via FTP to your plugin folder replacing your current copy. Once done enable myCRED.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Upgrading to v1.4.7. caused problems when displaying points’ is closed to new replies.