REGISTER or LOGIN to have the annoying ads removed.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SkunkMedals Help
#1
Hi. Does anybody know how to edit the member_profile template in such a way that their medals will appear in the user's profile?

I have already tried the following, but it did not work:

PHP Code:
<tr>
<
td class="trow1"><strong>User's Badges:</strong></td>
<td class="trow1">{$post['
medals']}</td>
</tr> 

Also, when I do write this into the member_profile, it messes up the Brief Summary section in the User CP.

Please help!

-Many thanks, Patrick
#2
It probably messes things up due to the code being a bit off. The first ' you use in User's blocks out the code until the second one you use before medals...and you left off the closing one after medals. Wink It won't work anyway, since I tried it every way I could think of as well.

If I can remember what Lex instructed on how to do this, I will share it...but I'm drawing a blank right now. I think he wrote a plugin for it as well as code to add. Since his site is down, I can't find it there. Maybe someone else who used his advise will remember.

edit: OK, this is funny. I figured it out...and the only reason why I was able to is because I recently uploaded Labrocca's new version, and the medals no longer appeared in my profile. So that told me that the changes I made were in the actual medals plugin. LOL...so here is what you need to do to make the medals show up in your profile. You might need to fine tune if you want text, since I didn't want that for my forum.

Open the actual plugin file medals.php and find:

Code:
$plugins->add_hook("postbit", "get_medals");

add under

Code:
$plugins->add_hook("member_profile_end", "get_medals_mem");

then add the following function beneath the deactivate function:

Code:
function get_medals_mem()
{

global $db, $mybb,$config, $memprofile, $medals;
$uid=intval($memprofile['uid']);

// check Number of medals, exit if no medals
$query = $db->simple_select(TABLE_PREFIX.'medals_awarded', 'COUNT(*) AS count',"uid=".$uid);
    $medal_count = $db->fetch_array($query);
    if($medal_count['count'] > 0)
    {
    $medals = "<div style=\"white-space: normal; width:100%;\">";
        $medals_query = $db->query("select `mid` from `". TABLE_PREFIX."medals_awarded` where `uid`='".$uid."'");
        while($medals_list = $db->fetch_array($medals_query))
            {
                $medal_query = $db->query("select `mid`,`description` from `".TABLE_PREFIX."medals_list` where `mid` = '".$medals_list['mid']."'");
        $medal = $db->fetch_array($medal_query);
            $imgsrc = $mybb->settings['bburl']."/".$mybb->settings['uploadspath'].'/medals/'.$medal['mid'].'.jpg';
        $medals .= " <img src=\"{$imgsrc}\" alt=\"{$medal['description']}\"  title=\"{$medal['description']}\" border=\"0\" />";
        }
    $medals .= "</div>";
    }
    if(!$medals)
    {
        $medals = "No Medals";
    }
}

and then open up your member_profile template and add {$medals} anywhere that you want the medals to show up. That should do it. I just redid everything and the medals are back in my profile.
#3
Thanks very much; excellent, well-explained advice!
#4
Hey look everyone Jude is knowledgable. Smile
#5
Har har Tongue Dealing with all the myps addons HAS given me more insight into the way plugins work. It's my hope to someday be able to actually create one myself. LOL
#6
this is indeed very useful information =) been trying this edit myself ^^

Edit: one other bug i noted which i'm not sure if others have experienced ... in MyBB v.1.2.12 ... when this perticullar mod is made & if u have the FORUM WARNING SYSTEM PLUGIN Activated ... this puts medals at random areas in the thread post User Profile ... which appears to the left. "commonly it tends to place medals afore the warning meter"

simple fix i noted for this woz deactivate FORUM WARNING SYSTEM PLUGIN ... THEN ... ACTIVATE SkunkMedals PLUGIN ... then activate FORUM WARNING SYSTEM PLUGIN ... this fixes it with out doing anyother mod ...

the above stated error woz spotted in IE7 ... not sure if it exists in anyother browser ... ^^

thought i should make a note incase sumone else experiences this error ^^


Possibly Related Threads...
Thread Author Replies Views Last Post
  Skunkmedals fixed version ( medal and award system) labrocca 104 57,815 Sep 07, 2008, 02:37 AM
Last Post: Moko

Forum Jump:


Users browsing this thread: 1 Guest(s)