Introduction to myCRED Ranks

Home / Tutorials / Introduction to myCRED Ranks

Description

In this tutorial I will introduce you to the myCRED Ranks add-on. We will set up a few ranks and I will show you how to present ranks for users and how to customize your theme to accommodate ranks via custom templates.

Requirements

  • myCRED 1.1 or higher.
  • Basic understanding of how WordPress theme template files work.

Introduction

The myCRED Ranks add-on allows you to setup ranks based on how many points a user has. Ranks are custom post types and are edited and created just as posts or pages.

Each rank holds three sets of information: The Ranks Title, The Points Requirement and optionally the Rank “Logo” which is the Featured Image feature in WordPress.

There is no limit to how many ranks you can have, as long as the points requirements does not overlap.

Just as with posts and pages, you can save Ranks as drafts, Publish a rank or Schedule a rank for being published at a later date.

When a rank is “Published”, myCRED will run though all of your users and assign those who meet the points requirements to the rank you just created. So draft ranks or scheduled ranks are not assigned until they get published!

While Ranks also support ranks to be set as “Private” it is not recommended. The rank shortcodes that present ranks on your website will only display Public Published ranks! On the other hand, if you use custom theme template files for your ranks, you could technically display “Private” ranks just as posts for those who can see them.

Note that Rank editing and creation requires you to have the same capabilities as when publishing pages. This means that if you are using the default WordPress roles, only Administrators will have access to editing and creating ranks.

To start using Ranks, simply visit the “Add-ons” sub-menu page under “myCRED” in your Admin area and enable the “Ranks” add-on.

ranks-activateaddon

Settings

To change your Ranks settings, visit the “Settings” sub-menu under “myCRED” and click on “Ranks” section.

Here you can adjust what features the Rank post type should offer, by default only rank title, point requirement and featured image is enabled but myCRED as of 1.1.1 also supports the editor, comments, excerpt or page attributes.

By default, myCRED ranks are not public. This means that the only way to see ranks or to list ranks is by using shortcodes. You can however set ranks to be public enabling you to create archives or even custom single layouts in your theme folder. For more information on how to do this, have a look at this tutorial.

You can also select in what order ranks are shown both in the admin area and in front.

ranks-settings

Adding Ranks

ranks-default

By default, myCRED will create a rank called “Newbie”. This rank’s points requirement is set to range from 0 to 999999. Before we add a new rank, we start with editing this Newbie rank to suit our needs. Since this will be our lowest, default rank, we will leave the minimum points requirement at zero but we will change the maximum to 99.

Furthermore, in this tutorial, the newbie rank will have no logo, of course you can have one if you want.

Adjusting the default Rank

Once we have changed our maximum point requirement we click “Update” to save our settings. When our changes are saved, we click on “Add New” button next to the “Edit Rank” title.

We will call our new rank “Junior” and this ranks point requirement will run from a minimum of 100 to a maximum of 999.

You can of course rename the default rank to a name or even delete it and just start fresh.

ranks-addnew

Rank Logo

For this rank, we are going to add a logo. Just like any other Featured Image, we can either upload an image to use or select one from your Media Library. When you have found your image, simply select it and click “Set Featured Image”. Once your image is visible in your “Featured Image” metabox, we click “Publish”.

ranks-selectlogo

Rince and repeat

Now that we have created our new rank, we can create as many ranks as we need. Simply repeat the above steps for each rank until you’re satisfied.

Assigning Ranks

There are three instances when myCRED assigns a rank:

  • When a rank is published.
  • When users signup and become members on your website.
  • When a user gains or loses points.

This means that myCRED will assign roles for your users automatically without the need for you to do it individually. This also means that the only way for you to manually adjust a users rank is to award / deduct points form the user.

Showing Rank

Besides showing ranks though your themes template files, which we will look at in a second, you can also show your users ranks though the myCRED Balance widget or through the use of custom shortcodes. But lets start with the widget.

myCRED Balance Widget

When editing the balance widget, you get the option to set the “Layout” for how the balance is presented. You could include a users rank here by using the template tag %rank% to show the users rank title or %rank_logo% to show the rank logo.

ranks-widgetsetup

Depending on your theme, you might need to add some custom CSS styling to the image or title suit your website layout.

ranks-widgetresult

Shortcodes

myCRED Ranks comes with three different shortcodes that you can place in your page or post content.

    • mycred_my_rank
      Use this shortcode to show a specific users rank or by default, the current logged in users rank. Consult the codex for all available options.
    • mycred_users_of_rank
      Use this shortcode to display users of a specific rank. Consult the codex for all available options.
    • mycred_users_of_all_ranks
      Use this shortcode to show users of each and ever published rank in order. Consult the codex for all available options.

Done

That is the end of this introductory tutorial. If you have any questions feel free to post them below.

Feel free to post your questions or remarks below.

  1. Hi, I have a problem, all my suscibers are now on the last rank whereas they are only few points… It does just since yesterday but before there were no problems. I don’t understand :/

  2. Hi there,

    Is it possible to gate content within a post / page based on the myCred rank?

    I.e

    Lets say we want to give people that are rank 3 access to a video, but people that are a lower rank can’t see it or see a placeholder image.

    With membership plugins you can do if statements…

    If user = rank 3 show …. if not show…. etc.

    Any ideas for a MyCred solution to save adding another membership plugin ?

    1. You can either do this via your theme files or by hooking into WordPress and adjust the post loops to remove / replace content. It really comes down to what exactly you are looking for. Your users rank is stored as a custom user meta under the mycred_rank key. Each rank is a custom post type and this custom post types ID is what is stored for all users. So lets say the lowest rank you have is “Newbee” and it has the post ID 1, then you can adjust your WordPress install to for example hide certain posts from the loop if the current users rank is 1. You can always post your request in the support forum under “How to Questions”.

  3. For the %rank% template tag in the Leaderboard widget, it keeps defaulting to %ranking% – whenever I hit save it changes from rank to ranking. Any ideas?

    Thanks for a sweet plugin! Everything else is great 🙂

  4. Hello Gabriel
    I like this plugin
    But some i have been some problem
    This rank system is very slow in my home page
    How to Improve this problem ?
    My website member is 700 ~800

    1. How exactly are you using the rank system on your homepage? What is slow? Ranks are just like any other post in WordPress so there is nothing special about it that would cause load issues by default. Do you have like 100ds of ranks that you list on your front page?

  5. hey , i want show the current logged in users rank in my theme,
    i used ” ” ,but always has “0” as a result.
    Where is wrong ?

    thanks!

Leave a Reply

Last edited October 28, 2016