Customizing SMF > Modifications and Packages

Auto Award

(1/12) > >>

JohnWayne999:
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. If your forum has display for total number of posts disabled, then the medals won't show and vice versa. Note I haven't actually tested turning off this mod. Let me know if people have problems turning it off.

DISPLAY OF MEDALS
Currently I only coded for the medals to show in the profile window inside posts. For example you'll see medals inside new topics and people's replies. However if you then go check on individual members' personal profile page, you won't see the medals in there. If anyone wants the medals to appear in personal profile page also, please tell me which file handles that 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: ---$medalscore = array (10,20,30,40,50,100,150,200,300,400,600,800,1000,1300,1600,2000);
--- End code ---
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: ---echo '<img src="', '/Themes/default/images/medals', '/medal', $mc++, '.png" />';

--- End code ---
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. The coding is very straightforward. I don't see why it shouldn't work on nearby versions, although I never tested it on other version. So please test at your own risk. If it works on a different version, I would love to know (especially on SMF 1.x since I won't be testing them myself any more). 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.

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. Lastly but importantly, please remember to backup first before trying this mod.

Bugo:
HTML code is not valid. Look at:

--- Code: ---, alt="" /></li>';

--- End code ---
Please, remove a comma before alt.

JohnWayne999:
Ah well spotted. What was I thinking. Thanks. Corrected and uploaded as amendment5 now.

If there are any more issues, would appreciate people reporting them and I'll try fixing asap.

(If it works for you, I'd love to hear about it too.)

chinaren:

OMFG!!!  I could kiss you for this mod.  :-*  I've been looking for something like it for ever. 


Many blessing rain down upon you.  I've installed it and it works perfectly, though I'm going to adjust the medals an d counts a bit, as it takes up rather a lot of room as is. 
 

Now, I just need one for years of membership (that can go alongside this one).   :laugh:
Again, thank you for this!!

keyboard:
Thank you for this awesome mod.  It is a nice addition for any Board.  :) :)

My site has thousands of posts and I would like to increase the totals from:
$medalscore = array (10,20,30,40,50,100,150,200,300,400,600,800,1000,1300,1600,2000);

To:
$medalscore = array (10,20,30,40,50,100,250,500,750,1000,1500,2500,5000,7500,10000,20000);

So All I need to do, is to go to   /Themes/default/Display.template.php   and change the numbers?

Thanks
Ron

Navigation

[0] Message Index

[#] Next page

Go to full version