myCRED Custom Shortcode: Rank Progress

Home / Code Snippets / myCRED Custom Shortcode: Rank Progress

Creates a shortcode for displaying the user’s rank progress without the need for Visual Composer. It will allow you to display the current user’s rank progress bar (default), or enter a User ID to display that particular user’s rank progress. And lastly, the ability to show/hide the name of the user’s current rank, their next rank, and their points progress.

Add this code snippet to your theme's functions.php file, or to a custom plugin. Then, copy the css from mycred-users-rank-progress-shortcode-css to your theme's style.css file. Change the styles to fit your needs (colors, sizes, etc.) Finally, use the shortcode like so: [mycred_users_rank_progress user_id="1" show_rank="yes"] *This will show the rank progress of the admin user with the current and next ranks displayed

Last edited November 30, 2015

  1. Hello Christian,
    Thanks for sharing this snippet. Found it very helpful
    A little help would be awesome: any way of modifying the code to work with the default wordpress logged in functions? i.e. if I don’t have buddypress installed? (actually, I have userpro instead of buddypress, so a userpro-based code would also work).
    Thanks and keep up the great work!
    Raied.

    1. Greetings Raied,

      I’m in the process of updating this code snippet for myCRED 1.6, and I will be adding support for default wordpress login functions. As far as userpro goes, I don’t personally own the plugin, and I don’t have any way of studying the code to find the userpro equivalent of the function that checks to see if you are currently viewing a user’s buddypress profile.

  2. Hi,
    I would like to know if there is a way to view the articles that a user has already read, and propose a list of those still to be read
    Thank you
    Giorgio

  3. Try this:
    – Find:
    // Get the users current rank post ID
    $users_rank = (int) mycred_get_users_rank( $user_id, ‘ID’ );
    – Replace with:
    // Get the users current rank post ID
    $users_rank = mycred_get_users_rank_id( $user_id, $type_id );

    It’s due the rewrite of rank functions brought with v1.7 that your code stopped working.

  4. Hello
    It does not work on my website.
    I can’t find a solution and the problem is that the page where I put the shortcode is now partially empty.
    I can’t see the main content and the footer.
    Do you have an idea to solve that ?

    Thank you for your help

  5. Hello, I’m using myCRED version 1.6.9 and BuddyPress version 2.6.1.1. I put the code on the function.php but it doesn’t show anything on the user profile of buddypress and if I just write on a random page created on wordpress admin with the shortcode ‘[mycred_users_rank_progress user_id=”1″ show_rank=”yes”]’ it shows a fatal error.
    Any idea what could it be?
    I’m using the theme ascent, just in case.

    Thanks.

Leave a Reply