Customizing SMF > Modifications and Packages

Auto Award

<< < (2/10) > >>

thecoo1est:
aww yessss! Been waiting so long, wont you tell me if Im coming on to strong, this heart of mine has been hurt before, this time I want to be sure.

Been waiting for a mod like this to come into my life, it looks so simple to and yet everything it needs to be, thanks!

JohnWayne999:

--- Quote from: keyboard on January 03, 2012, 10:25:52 AM ---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?

--- End quote ---

Keyboard, yes.

Chinaren, years of membership sounds nice. I probably won't have time to do it in the near future. Do you know what the variable for that is (years of membership)?

Thanks guys for the feedback. I share your pain and joy.

One pending problem for this mod is the medals are not very well polished. They work fine with light themes. If you try dark theme the edges get ugly. Someone just needs to edit those medal edges pixel by pixel to smooth them out. I personally won't have the time to do this until end of 2012. If anyone is able to help out that'll be excellent (bear in mind the background of medal needs to remain transparent). Otherwise I might do it myself in 12 months time :D

Happy new year and may all your resolutions come true.

thecoo1est:
****** this is perfect I changed my icons already with png's, but I would like to name the icon if possible, so when a user hovers over with mouse a text popup will say what the award name is, would that be possible, not that its a big deal, Im super happy as is and thanks again, the mod is SWEEEET!

JohnWayne999:

--- Quote from: thecoo1est on January 04, 2012, 11:15:00 PM ---****** this is perfect I changed my icons already with png's, but I would like to name the icon if possible, so when a user hovers over with mouse a text popup will say what the award name is, would that be possible, not that its a big deal, Im super happy as is and thanks again, the mod is SWEEEET!

--- End quote ---

Hi Cool1est

That's a good suggestion and not too hard to implement.

Many ways to do it. I'll outline one approach, see if you or anyone wants to DIY. Otherwise I can throw it in the upgrade (may be months from now).

Look for alt"" part of the code.
Insert whatever text you like in there and it will show up when the user hovers mouse next to medal.

What you want though is each medal to show up a different description.
So you will need to set up a separate array that corresponds each icon with its own description. Once that correlation is set up, you can just retrieve that description accordingly by having the the alt= point to appropriate part of the array.

So something like this

Add after this code:
--- Code: ---foreach($medalscore as $ms){
--- End code ---
this line:    
--- Code: ---foreach($medaldesc as $md);
--- End code ---

Add after this code:
--- Code: ---$medalscore = array (10,20,30,40,50,100,150,200,300,400,600,800,1000,1300,1600,2000);
--- End code ---
this line:       
--- Code: ---$medaldesc = array ('Newbie', 'Medal2 Desc', 'Medal3 Desc', .., .., 'God');
--- End code ---
      
Replace this line:
--- Code: ---echo '<img src="', $imagesURL, '/medal', $mc++, '.gif" alt="" />';
--- End code ---
With this line:
--- Code: --- echo '<img src="', $imagesURL, '/medal', $mc++, '.gif" alt="$md" />';
--- End code ---

So overall it should look something like this:

--- Code: --- // Start of AutoAward
if (!isset($context['disabled_fields']['posts'])){
$imagesURL = $settings['default_images_url'] . '/medals';
$medalscore = array (10,20,30,40,50,100,150,200,300,400,600,800,1000,1300,1600,2000);
$medaldesc = array ('Newbie', 'Medal2 Desc', 'Medal3 Desc', .., .., 'God');

$mc=1;
foreach($medalscore as $ms){
foreach($medaldesc as $md);

if($message['member']['posts']>=$ms)
echo '<img src="', $imagesURL, '/medal', $mc++, '.gif" alt="$md" />';
} // end of ms foreach
} //end isset disabled fields if
// End of AutoAward.

--- End code ---

I haven't tested it yet. See if that works for you. You might get a bug from alt="$md". The foreach might give you grief. Or maybe not and you get lucky, everything works first go :D

Addendum: Actually on second look, this code won't work. You best use two dimensional array which I can't remember how to do :D The problem with coding is it's like an addiction. You code some, want to fix it more, fix more, want to code more. Before you know it a weekend has gone.

keyboard:
Hi

I am not a seasoned user of SMF and need to clarify something with you.....I have over 70 users.  I have added them all by registering them myself,  I did not assign a group to them,  so right now, they all have the  "no primary membergroup "..There have been a lot of posts and a lot of medals earned,  and now,  I would like to move all of them to a new Member Group called "Regular Members ".

Now after setting the permissions for a group called  "Regular Members", and if I assign all the Users from  "no primary member group " to this new Group,  will they lose all their hard earned medals ?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version