Advertisement:

Author Topic: How to display awards on the ultimate profile instead of mini profile  (Read 1311 times)

Offline wynnyelle

  • SMF Hero
  • ******
  • Posts: 2,530
    • Warrior Cats RPG
Can I take this code from display.template.php:

Code: [Select]
// 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?

Offline Scorpii

  • Newbie
  • *
  • Posts: 7
Re: How to display awards on the ultimate profile instead of mini profile
« Reply #1 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..
« Last Edit: February 17, 2012, 08:01:24 PM by Scorpii »

Offline wynnyelle

  • SMF Hero
  • ******
  • Posts: 2,530
    • Warrior Cats RPG
Re: How to display awards on the ultimate profile instead of mini profile
« Reply #2 on: February 17, 2012, 09:17:07 PM »
...That is beyond me. I don't understand. :( Sorry!

Offline Scorpii

  • Newbie
  • *
  • Posts: 7
Re: How to display awards on the ultimate profile instead of mini profile
« Reply #3 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.

Offline wynnyelle

  • SMF Hero
  • ******
  • Posts: 2,530
    • Warrior Cats RPG
Re: How to display awards on the ultimate profile instead of mini profile
« Reply #4 on: February 23, 2012, 03:06:05 PM »
I'm so sorry I was unable to figure this one out.