Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: wynnyelle on February 17, 2012, 06:16:22 PM

Title: How to display awards on the ultimate profile instead of mini profile
Post by: wynnyelle on February 17, 2012, 06:16:22 PM
Can I take this code from display.template.php:


// Show their awards?
if (!empty($message['member']['awards']) && $modSettings['awards_in_post'] > 0){
echo '
<li>
<fieldset class="awardboxonposts"; padding: 0px;">
';

// Couldn't limit it in Load.php, so let's do it here.
$awards = 0;
foreach ($message['member']['awards'] as $award){
if($awards < $modSettings['awards_in_post'])
echo '
<a href="', $scripturl, $award['more'], '"><img src="', dirname($scripturl), $award['img'], '" alt="', $award['description'], '" title="', $award['description'], '" /></a> ';
$awards++;
}

echo '
</fieldset>
</li>';
}


and just transplant it into the area of the ultimate profile I want the awards to display? Would that work?
Title: Re: How to display awards on the ultimate profile instead of mini profile
Post by: Scorpii on February 17, 2012, 07:57:40 PM
Should work fine, as long as all the proper global variables are defined at the start of the function you wish to place the code in. From the looks of your code, I would say you need global $scripturl, and $modSettings for sure, possibly $message as well..
Title: Re: How to display awards on the ultimate profile instead of mini profile
Post by: wynnyelle on February 17, 2012, 09:17:07 PM
...That is beyond me. I don't understand. :( Sorry!
Title: Re: How to display awards on the ultimate profile instead of mini profile
Post by: Scorpii on February 17, 2012, 09:36:43 PM
Go to your themes/default folder and find UltimateProfile.template.php. Open it and search through, find the spot you wish to insert your code. Make sure you make a backup of the file first. If you have trouble finding where to put it, try to look for chunks of code in comparison to what is being shown on the profile page, and look for the best fit. If it doesn't show up where you want it, you can always move your code.
When you've found a spot, paste your code in. Your code starts and ends in php, so make sure you don't paste your code where html is, try to keep it separate (notepadd++ is great for this stuff). Then scroll up until you see the start of the function that you pasted your code into, it will say function something(something else). Shortly after there is a line that says "global $something, $somethingElse," etc. Make sure that $scripturl, $modSettings, and $message are also entered there if they are not already.
Title: Re: How to display awards on the ultimate profile instead of mini profile
Post by: wynnyelle on February 23, 2012, 03:06:05 PM
I'm so sorry I was unable to figure this one out.