Advertisement:

Navigation

SMF Mod Site

Mod Name:
Auto Award
Created By:
JohnWayne999
Type:
Profile
First Created:
October 16, 2011, 04:02:12 AM
Last Modified:
March 26, 2017, 06:02:22 AM
Latest Version:
1.0
Compatible With:
1.1.15, 1.1.16, 1.1.17, 1.1.18, 1.1.21, 2.0.1, 2.0.2, 2.0.3, 2.0.5, 2.0.6, 2.0.9, 2.0.10, 2.0.11, 2.0.13
Total Downloads:
8421

Download this mod

AutoAward(amendment7).zip (120kB) [8103]
Manual Install Instructions for SMF


Below are some preview images of what the mod looks like when being used

Description:

Link to Mod

Sixteen medals in total and are awarded automatically based on post count. Takes effect right away and also retrospectively. For example some members may have made many posts already prior to introduction of this mod. Not to worry. As soon as this mod is installed, all members will be awarded all medals they deserve.

TURN ON/OFF
This mod piggy backs on total number of posts and display of it. So make sure your forum has display for total number of posts enabled in order for this mod to work. By default this should be on anyway (already on), so you shouldn't need to worry too much.

DISPLAY OF MEDALS
Medals will be displayed under the poster's name in the posts, currently not displaying in profile page.

DIRECTORY WHERE MEDALS ARE STORED
Medals are stored in /Theme/default/images/medals
Feel free to add more or remove medals. I find 35 x 60 pixels a good size, but you are free to change that ratio as you please. HTML tables can be implemented easily to accommodate for varied sizes. This might be a feature of future version.

Please keep your medal filenames to medal1.png, medal2.png, medal3.png,.. in sequence because that's how they will be fetched in that order. I have included /Themes/default/medal1.png - medal16.png for you. You can change pictures or use different file extensions (eg. medal1.jpg, medal2.jpg...) but as long as the first part of filename sticks to sequential medal1, medal2 etc. Note also if you are using .gif then all files are .gif. If you want to use .png, then all files are .png, no mixing around please. For example medal1.gif, medal2.jpg, medal3.png will not work.

SETTING POST COUNTS FOR AWARDS
To specify how many posts deserves the next medal, simply go into /Themes/default/Display.template.php and change the numbers in

Code: [Select]
$medalscore = array (10,20,30,40,50,100,150,200,300,400,600,800,1000,1300,1600,2000);For example the way this array is set up by default now says there are 16 medals in total (16 elements in the array). To be awarded the first medal, you need to have posted a total of 10 posts. Not too hard. To be awarded the next medal, you need to post another 10 posts (absolute total of 20 posts). To get the final 16th medal, you need to post in total 2000 posts (can be new topics and/or replies, as long as they add up to 2000 from the time you registered to this forum). If you wish to add an additional medal to the reservoir, just lengthen the array, and don't forget to also place your medal#.png in /Theme/default/images/medals where # is sequential natural number. For example, obviously the next file in line will be medal17.png

Just a few quick clarifications:
Note 1: The numbers in the array are absolute number of posts not incremental posts.
Note 2: Person who receives current award, is also automatically awarded all awards below it if not already done so. For example if a member has been with this forum for some time, has posted 100 posts before this mod was installed. Now you install this mod, he is automatically awarded 6 medals all at once (for 10,20,30,40,50,100 posts check points).
Note 3: Obviously the numbers in the array need to be getting larger towards the right. For example it makes no sense setting up an array of 50,10,60,30,70,5,100,...
Note 4: If you see next to the medals an error message that says someone "has no influence", that means your array is longer than there are actually images for medals. To solve this problem is simple: either shorten your array, or add a few more images into /Theme/default/images/medals

USING IMAGES OTHER THAN PNG
Currently the engine searches for .png automatically. If you prefer .jpg or something else, just go into the file /Themes/default/Display.template.php and scroll down to this line
Code: [Select]
echo '<img src="', '/Themes/default/images/medals', '/medal', $mc++, '.png" />';
Change the .png in there to dot whatever extension you like. For example .jpg or .gif

BASE AWARD ON OTHER THAN POST COUNT
If you want the medals to be awarded based on something like how much money the user has, karma, or how long since he/she registered, it's pretty straightforward also. Just replace the variable $message['member']['posts'] with whatever variable you have in mind, as long as you know what those exact variables are.

FORWARD & BACKWARD COMPATIBILITY
This mod was developed and tested fine on SMF 2.0.1. NOTE: THIS MOD HAS NOT BEEN TESTED BY MYSELF ON ANY VERSION AFTER 1.1.15 or 2.0.1. The actual code is very small and straightforward. Please test at your own risk. If it works on a recent different version, I would love to know. For all upgrades, please firstly uninstall existing version of AutoAward then install the new version. Alternatively you can just look at the code for minor changes and DIY. Please always backup your data before trying any new mod. That will save you hours of debugging or re-installing. Just back up and copy back to last save point if need be, is the fastest and safest way.

BUGS
This mod will execute on any theme now, best against light themes. Earlier versions had poorly processed medals which showed unclean edges against dark backgrounds. You might still see examples of them in sample snapshots. The tools I used were InstantMask and iaza.com to make the medals' background transparent. These are free but rather basic tools. ARG very kindly polished up the medals nicely. So now most themes (even dark themes) should do fine.  You may still find occasional gray themes problematic.

FUTURE CONSIDERATIONS
1. Autoscale, so admin can just throw medals of any size into the directory, and medals will automatically be scaled to equal size on display.
2. Might add descriptions to individual medals.
3. Have the medals show up in personal profile page.
4. Would be interesting to make some sort of game out of the rankings. For example allow people to trade medals or sell them for non-real money on the forum.

OTHER RECOMMENDATIONS
If you enjoy this mod, then maybe you would be interested in SMF Shop by vbgamer45 and Member Awards by Spuds also. SMF Shop lets users buy things using credits earned from posts. You can reserve special edition medals for people to purchase or swap around. Member Awards is straight forward. Moderators can award individual members things (eg. trophies or limited edition medals) which will stick to their profile and album indefinitely.

UPDATE LOG
Amendment 1: Removed excess variable $medalmax
Amendment 2: Added alt="" for XHTML 
Amendment 3: Internalised if (!isset($context['disabled_fields']['posts']))
Amendment 4: Fixed <install for="2.0 - 2.0.99">
Amendment 5: Corrected HTML bug - excess comma in front of alt="" (thanks to beta tester Bugo)
Amendment 6: Corrected vertical alignment.
Amendment 7: Special thanks for ARG for polishing up medal edges and backgrounds which now work well against most dark themes


That's about it in a nutshell. Thanks for using Auto Award! All comments, suggestions including feature requests are welcome at http://www.simplemachines.org/community/index.php?topic=462876.msg3232239#msg3232239 . Check out some of the posts there as people have posted ways of fine tuning and adding features to this mod DIY, for example adding comments to icons, or setting number of icons per row.

Lastly but importantly, please remember to backup first before trying this mod.