News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

How to display awards on the ultimate profile instead of mini profile

Started by wynnyelle, February 17, 2012, 06:16:22 PM

Previous topic - Next topic

wynnyelle

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?

Scorpii

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..


Scorpii

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.


Advertisement: