1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Custom Rankings 0.2

Discussion in 'Plugins' started by Nick, Mar 14, 2010.

  1. Nick

    Nick Well-Known Member

    Custom Rankings
    Version: 0.1
    Author: Nick Ramsay
    Created:
    2010/03/14
    Last Updated: 2010/07/29
    Tested on: Hotaru 1.1.2 ~ 1.4.0
    Plugins Required: User Rankings
    Plug & Play: Yes
    Supported: Yes

    Description
    This plugin hooks into the User Rankings plugin so you can assign custom ranks and icons to each user according to their score.

    Instructions
    1. Upload the "custom_rankings" folder to your plugins folder.
    2. Install it from Plugin Management in Admin.
    3. Customize your rankings in Admin -> Plugin Settings -> User Settings

    Notes
    Both the widget and page use the HTML cache so if you change a setting you will probably need to clear the HTML cache from Admin -> Maintenance.

    Customizing
    Custom Rankings comes with 5 default 16x16 images called 1.png ~ 5.png. You can replace those with your own .png images as long as you number them from 1 upwards, where 1.png matches your lowest rank. Please make a backup of your images just in case this plugin gets upgraded and you overwrite your customizations,

    Revision History
    v.0.2 2010/07/29 - Nick - Bug fixes for images matching the wrong levels
    v.0.1 2010/03/14 - Nick - Released first version

    Please click "Rate Thread" and give this plugin a rating. Thank you.

     

    Attached Files:

    apfind and melony like this.
  2. Nick

    Nick Well-Known Member

    If you want to use names instead of numbers for images, try this:

    Change line 87 (approx) from this:

    PHP:
    $output .= "<img src='" BASEURL "content/plugins/custom_rankings/images/" . ($i+1) . ".png' alt='" sanitize($level'ents') . "' title='" sanitize($level'ents') . "' />";
    to this:

    PHP:
    $output .= "<img src='" BASEURL "content/plugins/custom_rankings/images/" strtolower($level) . ".png' alt='" sanitize($level'ents') . "' title='" sanitize($level'ents') . "' />";
    That works with single words like "master", but if you have "grand master", you'd need to use make_url_friendly($level) instead of strtolower. That will give you "grand-master".

    Also, in that same line, you can change .png to .gif or .jpg if necessary.
     
  3. Nick

    Nick Well-Known Member

    I've noticed a bug in this, and have a temporary fix.

    Example:

    10 Levels: Jonokuchi, Jonidan, Sandamme, Makushita, Juryo, Makuuchi, Komusubi, Sekiwake, Ozeki, Yokozuna
    10 Points: 0, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 10000

    You can save that and it works, but after saving it, the "0" is stripped from the points list so if you save again you'll get an error because there are now fewer elements in the points list than the levels list. So, you need to put the 0 back in each time you save it.
     
    anthonyr likes this.

Share This Page