News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

Member Awards (2.0 Compatible!)

Started by Spuds, September 18, 2006, 03:14:03 PM

Previous topic - Next topic

Arantor

Sorry, but I really don't have the time to debug a mod I don't even use ;)
Holder of controversial views, all of which my own.


swiftmed

Quote from: Arantor on May 18, 2010, 05:52:43 PM
Sorry, but I really don't have the time to debug a mod I don't even use ;)

Yeah thats cool. Can anybody give me a rough Idea of where I should be looking please?

P.S. - How does the 'charter member' badge appear beside your post on here? Are they using an awards mod of some sort, because thats exactly what Im trying to get on my forum.
With Regards,
Andrew MacDonald

http://cherylanncole.co.uk/forums
SMF 2.0 RC2

Arantor

All it is is a different primary membergroup with that as the 'star' image, repeated once. Exactly how it is for all the team members here, in fact.
Holder of controversial views, all of which my own.


swiftmed

Quote from: Arantor on May 18, 2010, 05:59:11 PM
All it is is a different primary membergroup with that as the 'star' image, repeated once. Exactly how it is for all the team members here, in fact.

Ah I see. So it's a bit of a work-around, not really something that could be used as an awards system.
With Regards,
Andrew MacDonald

http://cherylanncole.co.uk/forums
SMF 2.0 RC2

Arantor

Not really a workaround, just using the system that's there how it was designed. It's not an awards system, it's about assigning a primary group to a user, which carries permissions (in the case of Charter members, it carries access to the Charter only boards, plus access to the helpdesk here)
Holder of controversial views, all of which my own.


swiftmed

Quote from: Arantor on May 18, 2010, 06:03:45 PM
Not really a workaround, just using the system that's there how it was designed. It's not an awards system, it's about assigning a primary group to a user, which carries permissions (in the case of Charter members, it carries access to the Charter only boards, plus access to the helpdesk here)

Yeh I understand. I think my best bet is to try and get this awards mod working. Every other aspect of it is fine, just this choosing of the members is the problem. Im hoping somebody here can point me in the right direction...
With Regards,
Andrew MacDonald

http://cherylanncole.co.uk/forums
SMF 2.0 RC2

LC

Quote from: Arantor on May 18, 2010, 05:48:27 PM
Auto suggest only kicks in as standard for 3 letters since it appears to be invoking the standard SMF code.

If it's not working full stop that would imply there's some other Javascript it's breaking on. Does it work for sending personal messages?
Thanks Arantor. I did change the name I kinda figured a single lettered name was disliked by SMF"s auto suggest :P, but it won't show up. Other names will. So odd. :| I wonder if I need to reinstall the mod or something to get it to "catch" the new name...

Arantor

Hmm, don't know.

Best ask the man with the code :P
Holder of controversial views, all of which my own.


LC

Haha. Looks like I will have ta stalk him a little. :P

swiftmed

I've managed to fix my problem. I did a manual install and made a mistake at the end. I put the awards.js file into the images folder instead of the scripts folder.

Feel a right idiot now, but I managed to fix it, so thats all that matters. :D
With Regards,
Andrew MacDonald

http://cherylanncole.co.uk/forums
SMF 2.0 RC2

JBlaze

Quote from: LC on May 18, 2010, 04:51:44 PM
Hey Mr. JBlaze,

I'm running this on a custom theme'd RC3 and its working fine until you try to add a person who has a single character letter as their name. I changed the name, yet it still will not auto-suggest the name to add to an award. Is there a way I can get around this?

Also, I have broken images for the "assign, edit, delete and so on" for the buttons to operate the mod. Let me know if you need to look at any of my files.

Thanks. :)

LC

The broken images just means that you have to add the ./images/awards directory to your custom theme's ./images directory.

As for the auto-suggest, as stated above, it only kicks in after 3 characters since it's the same script from SMF. I'll see if I can get it to work without auto-suggest as well in a later version.


Quote from: LC on May 18, 2010, 06:21:30 PM
Haha. Looks like I will have ta stalk him a little. :P

As if you don't enough already :P
Jason Clemons
Former Team Member 2009 - 2012

LC

#1751
See the thing is I did change the name to a much longer one, about 6 letters, but it still won't show up on the auto-suggest. /facepalm  I wish I could figure out how to "make" it catch the new name.

Quote

As if you don't enough already  :P

You wish! :)

Edit: I was able to assign the name after I cleared out my browser's cache and did a hard restart. So weird. But at least it's fixed. As far as the images, I did not have the folder in there. Must have not stuck when I did the install. Der. Thanks Arantor and Jblaze, I owe ya for my newbiness. :)

swiftmed

Hey guys,

Finally got pretty much all my awards system working as I want, however Im having a problem with the award image link which appears under a persons avatar.

The image link takes people to a page not found error on my website. Im using prettyurls. I need to change that link somehow. The page I would like it to link to is the awards page on a users profile, the page that shows the awards that user has won before.

Wrong Link: www.cherylanncole.co.uk/forums/index.php?action=profile;area=awardsMembers;id=4
Correct Link: www.cherylanncole.co.uk/forums/index.php?action=profile;area=showAwards;u=70

Basically I need it to link to the same url as the 'Show Awards' link on the user profile. How exactly can I do that please?

I know the area of code which needs to be changed in the display.template.php page, but im not sure what to change it to?
echo '
<a href="', $scripturl, $award['more'], '"><img src="', dirname($scripturl), $award['img'], '" alt="', $award['description'], '" title="', $award['description'], '" /></a> ';
$awards++;

With Regards,
Andrew MacDonald

http://cherylanncole.co.uk/forums
SMF 2.0 RC2

Coolie

Any idea what is causing the problem I'm having, JBlaze?

JBlaze

I'll be able to respond to your support questions when I am done moving my family to their new home.

Until then, I cannot help you.
Jason Clemons
Former Team Member 2009 - 2012

C4G-TK

#1755
@JBlaze

This may help people with the problem in the profile area for the Awards List and the Show Awards.  I compared the last version of Fustrate's Profile.template.php file with yours.  I know that you changed some coding and such, but after mixing and matching both of them, I have two pages that are now working on my forum.  This may at least get you started on where things need fixed as all of my columns are now fixed and the images appear in the correct order.

Please note, my earlier post about it interfering possibly with the Ad Management Mod was not the case, so I edited that part out of my previous reply.

Here is the code that I used in order to get my pages working.  I'm going to check it on my other forum that has 6 pages of awards tomorrow.  Also, I attached two pictures of what it looks like now.  (A few posts back, you can see what it looked like previously.)

****If anyone uses this to correct your problem and it does not work in the PROFILE AREA just find this code again and replace it with what JBlaze originally had. 

Replace the code in Profile.template.php:
// This is the template for the awards
function template_awards(){
global $context, $modSettings, $txt, $settings;

echo '
<div class="cat_bar">
<h3 class="catbg">
' ,$txt['awards'], '
</h3>
</div>';

// Show the amount of awards that a member has
if (!empty($context['count_awards']))
echo '
<p class="description">
', sprintf($txt['awards_count_badges'], $context['count_awards']), '
</p>';

// Check if this member has any awards
if (empty($context['categories']))
echo '
<p class="description">
', $txt['awards_no_badges_member'], '
</p>';
else {

foreach($context['categories'] as $category){
echo '
<div class="cat_bar">
<h3 class="catbg">
', $category['name'], '
</h3>
</div>
<table class="table_grid" width="100%">
<thead>
<tr class="catbg">
<th scope="cols" class="smalltext" width="15%">', $txt['awards_image'], '</th>
<th scope="cols" class="smalltext" width="15%">', $txt['awards_mini'], '</th>
<th scope="cols" class="smalltext" width="20%">', $txt['awards_name'], '</th>
<th scope="cols" class="smalltext" width="45%">', $txt['awards_description'], '</th>
<th scope="cols" class="smalltext" align="center" width="5%">', $txt['awards_favorite2'], '</th>
</tr>
</thead>
<tbody>';

$which = true;

foreach ($category['awards'] as $award){
$which = !$which;

echo '
<tr class="windowbg', $which ? '2' : '', '">
<td align="center"><a href="', $award['more'], '"><img src="', $award['img'], '" alt="', $award['award_name'], '" /></a></td>
<td align="center"><a href="', $award['more'], '"><img src="', $award['mini'], '" alt="', $award['award_name'], '" /></a></td>
<td><strong>', $award['award_name'], '</strong></td>
<td><em>', $txt['months'][$award['time'][1]], ' ', $award['time'][2], ', ', $award['time'][0], '</em>: ', $award['description'], '</td>
<td align="center">', $context['allowed_fav'] ? '<a href="' . $award['favorite']['href'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . $award['favorite']['img'] . '</a>' : '', '', ($award['favorite']['fav'] == 1 ? ' <img src="' . $settings['images_url'] . '/star.gif" alt="' . $txt['awards_favorite']. '" />' : ''), '</td>
</tr>
</tbody>
</table>';

}
}

// Show the pages
echo '
<p class="catbg">
<span class="smalltext">', $txt['pages'], ': ', $context['page_index'], '</span>
</p>';
}
}

function template_awards_members()
{
global $context, $scripturl, $txt;

// Open the form
echo '
<div class="cat_bar">
<h3 class="catbg">
', $txt['awards_members_with'], ': ', $context['award']['name'], '
</h3>
</div>
<div class="windowbg">
<span class="topslice"><span></span></span>
<div class="content" align="center">
<img src="', $context['award']['img'], '" alt="', $context['award']['name'], '" /><br />
<strong>', $context['award']['name'], '</strong><br />
', $context['award']['description'], '
</div>
<span class="botslice"><span></span></span>
</div>
<div class="cat_bar">
<h3 class="catbg">
', $txt['members'], '
</h3>
</div>';

// Check if there are assigned members
if (empty($context['award']['members']))
echo '
<p class="description">
', $txt['awards_no_assigned_members2'], '
</p>';
else {
$which = true;
$counter = 0;

echo '
<table class="table_grid" width="100%">
<tbody>';

// Loop through the members
foreach($context['award']['members'] as $member){
if ($counter < 1)
echo '
<tr class="windowbg', $which ? '2' : '', '">';

echo '
<td width="*">', $member, '</td>';

$counter++;

if ($counter == $context['columns']){
echo '
</tr>';

$counter = 0;
$which = !$which;
}
}

// If $counter is not = 0 then we must close the last tr
if ($counter != 0)
echo '
<td colspan="', ($context['columns'] - $counter), '">&nbsp;</td>
</tr>';
}

echo '
</tbody>
</table>';

}

function template_awards_list(){
global $context, $modSettings, $txt, $settings;

echo '
<div class="cat_bar">
<h3 class="catbg">
', $txt['awards_title'], '
</h3>
</div>';

// Check if there are any awards
if (empty($context['categories']))
echo '
<p class="description>
', $txt['awards_error_no_badges'], '
</p>';
else {
foreach($context['categories'] as $key => $category){
echo '
<div class="title_bar">
<h3 class="titlebg">
<a href="', $category['view'], '">', $category['name'], '</a>
</h3>
</div>
<table class="table_grid" width="100%">
<thead>
<tr class="catbg">
<th scope="cols" class="smalltext" width="15%">', $txt['awards_image'], '</th>
<th scope="cols" class="smalltext" width="15%">', $txt['awards_mini'], '</th>
<th scope="cols" class="smalltext" width="25%">', $txt['awards_name'], '</th>
<th scope="cols" class="smalltext" width="40%">', $txt['awards_description'], '</th>
<th scope="cols" class="smalltext" width="5%">&nbsp;</th>
</tr>
</thead>
<tbody>';

$which = false;

foreach ($category['awards'] as $award){
$which = !$which;

echo '
<tr class="windowbg', $which ? '2' : '', '">
<td align="center"><img src="', $award['img'], '" alt="', $award['award_name'], '" /></td>
<td align="center"><img src="', $award['small'], '" alt="', $award['award_name'], '" /></td>
<td>', $award['award_name'], '</td>
<td>', $award['description'], '</td>
<td class="smalltext">
<a href="', $award['view_assigned'], '">', $txt['awards_button_members'], '</a>
</td>
</tr>
</tbody>
</table>';
}
}

// Show the pages
echo '
<span class="smalltext">', $txt['pages'], ': ', $context['page_index'], '</span>';
}
}



With this code:
// This is the template for the awards
function template_awards(){
global $context, $modSettings, $txt, $settings;

echo '
<table border="0" cellspacing="1" cellpadding="4" align="center" width="100%" class="bordercolor">
<tr class="titlebg">
<td colspan="5">' ,$txt['awards'], '</td>
</tr>';


// Show the amount of awards that a member has
if (!empty($context['count_awards']))
echo '
<tr class="windowbg">
<td colspan="5" align="center">
', sprintf($txt['awards_count_badges'], $context['count_awards']), '
</td>
</tr>';

// Check if this member has any awards
if (empty($context['categories']))
echo '
<tr class="windowbg2">
<td colspan="5">', $txt['awards_no_badges_member'], '</td>
</tr>';
else {

foreach($context['categories'] as $category){
echo '
<tr class="catbg">
<td colspan="5">', $category['name'], '</td>
</tr>
<tr class="windowbg3">
<td width="15%">', $txt['awards_image'], '</td>
<td width="15%">', $txt['awards_mini'], '</td>
<td width="20%">', $txt['awards_name'], '</td>
<td width="45%">', $txt['awards_description'], '</td>
<td align="center" width="5%">', $txt['awards_favorite2'], '</td>
</tr>';

$which = true;

foreach ($category['awards'] as $award){
$which = !$which;

echo '
<tr class="windowbg', $which ? '2' : '', '">
<td align="center"><a href="', $award['more'], '"><img src="', $award['img'], '" alt="', $award['award_name'], '" /></a></td>
<td align="center"><a href="', $award['more'], '"><img src="', $award['mini'], '" alt="', $award['award_name'], '" /></a></td>
<td><strong>', $award['award_name'], '</strong></td>
<td><em>', $txt['months'][$award['time'][1]], ' ', $award['time'][2], ', ', $award['time'][0], '</em>: ', $award['description'], '</td>
<td align="center">', $context['allowed_fav'] ? '<a href="' . $award['favorite']['href'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . $award['favorite']['img'] . '</a>' : '', '', ($award['favorite']['fav'] == 1 ? ' <img src="' . $settings['images_url'] . '/star.gif" alt="' . $txt['awards_favorite']. '" />' : ''), '</td>
</tr>';

}
}

// Show the pages
echo '
<tr class="catbg">
<td align="left" colspan="5">
<b>', $txt['pages'], ':</b> ', $context['page_index'], '
</td>
</tr>';
}

echo '
</table>';

}

function template_awards_members()
{
global $context, $scripturl, $txt;

// Open the form
echo '
<div class="cat_bar">
<h3 class="catbg">
', $txt['awards_members_with'], ': ', $context['award']['name'], '
</h3>
</div>
<div class="windowbg">
<span class="topslice"><span></span></span>
<div class="content" align="center">
<img src="', $context['award']['img'], '" alt="', $context['award']['name'], '" /><br />
<strong>', $context['award']['name'], '</strong><br />
', $context['award']['description'], '
</div>
<span class="botslice"><span></span></span>
</div>
<div class="cat_bar">
<h3 class="catbg">
', $txt['members'], '
</h3>
</div>';

// Check if there are assigned members
if (empty($context['award']['members']))
echo '
<p class="description">
', $txt['awards_no_assigned_members2'], '
</p>';
else {
$which = true;
$counter = 0;

echo '
<table class="table_grid" width="100%">
<tbody>';

// Loop through the members
foreach($context['award']['members'] as $member){
if ($counter < 1)
echo '
<tr class="windowbg', $which ? '2' : '', '">';

echo '
<td width="*">', $member, '</td>';

$counter++;

if ($counter == $context['columns']){
echo '
</tr>';

$counter = 0;
$which = !$which;
}
}

// If $counter is not = 0 then we must close the last tr
if ($counter != 0)
echo '
<td colspan="', ($context['columns'] - $counter), '">&nbsp;</td>
</tr>';
}

echo '
</tbody>
</table>';

}

function template_awards_list(){
global $context, $modSettings, $txt, $settings;

echo '
<table border="0" cellspacing="1" cellpadding="4" align="center" width="100%" class="bordercolor">
<tr class="titlebg">
<td colspan="5">' ,$txt['awards_title'], '</td>
</tr>';

// Check if there are any awards
if (empty($context['categories']))
echo '
<tr class="windowbg2">
<td colspan="5">', $txt['awards_error_no_badges'], '</td>
</tr>';
else {
foreach($context['categories'] as $key => $category){
echo '
<tr class="catbg">
<td colspan="5">', $category['name'], '</td>
</tr>
<tr class="windowbg3">
<td width="15%">', $txt['awards_image'], '</td>
<td width="15%">', $txt['awards_mini'], '</td>
<td width="20%">', $txt['awards_name'], '</td>
<td width="45%">', $txt['awards_description'], '</td>
<td align="center" width="5%">', $txt['awards_members2'], '</td>
</tr>';

$which = false;

foreach ($category['awards'] as $award){
$which = !$which;

echo '
<tr class="windowbg', $which ? '2' : '', '">
<td align="center"><a href="', $award['more'], '"><img src="', $award['img'], '" alt="', $award['award_name'], '" /></a></td>
<td align="center"><a href="', $award['more'], '"><img src="', $award['small'], '" alt="', $award['award_name'], '" /></a></td>
<td><strong>', $award['award_name'], '</strong></td>
<td><strong>', $award['description'], '</strong></td>
<td class="smalltext">
<a href="', $award['view_assigned'], '">', $txt['awards_button_members'], '</a>
</td>
</tr>';

}
}

// Show the pages
echo '
<tr class="catbg">
<td align="left" colspan="5">
<b>', $txt['pages'], ':</b> ', $context['page_index'], '
</td>
</tr>';
}

echo '
</table>';

}





UPDATE: I couldn't wait and something is up with adding attachments right now, so hopefully I didn't just triple post here.

I went ahead and did the edit on my other forum that has a LOT of awards to see if the pageination and Profile pages worked with the edit in the previous post.

(Didn't realize that I had 7 pages of awards, yikes.)

Here are BEFORE and AFTER pics of the error and what it now looks like on the forum.  Much better!

-img removed-

swiftmed

Quote from: C4G-TK on May 21, 2010, 01:40:06 AM
@JBlaze

This may help people with the problem in the profile area for the Awards List and the Show Awards.  I compared the last version of Fustrate's Profile.template.php file with yours.  I know that you changed some coding and such, but after mixing and matching both of them, I have two pages that are now working on my forum.  This may at least get you started on where things need fixed as all of my columns are now fixed and the images appear in the correct order.

Please note, my earlier post about it interfering possibly with the Ad Management Mod was not the case, so I edited that part out of my previous reply.

Here is the code that I used in order to get my pages working.  I'm going to check it on my other forum that has 6 pages of awards tomorrow.  Also, I attached two pictures of what it looks like now.  (A few posts back, you can see what it looked like previously.)

Thanks so much for your post with the new code. That totally fixed my problem with regards to the dodgy page layout too, so thank you!!
With Regards,
Andrew MacDonald

http://cherylanncole.co.uk/forums
SMF 2.0 RC2

C4G-TK

Quote from: swiftmed on May 21, 2010, 10:25:53 AM
Quote from: C4G-TK on May 21, 2010, 01:40:06 AM
@JBlaze

This may help people with the problem in the profile area for the Awards List and the Show Awards.  I compared the last version of Fustrate's Profile.template.php file with yours.  I know that you changed some coding and such, but after mixing and matching both of them, I have two pages that are now working on my forum.  This may at least get you started on where things need fixed as all of my columns are now fixed and the images appear in the correct order.

Please note, my earlier post about it interfering possibly with the Ad Management Mod was not the case, so I edited that part out of my previous reply.

Here is the code that I used in order to get my pages working.  I'm going to check it on my other forum that has 6 pages of awards tomorrow.  Also, I attached two pictures of what it looks like now.  (A few posts back, you can see what it looked like previously.)

Thanks so much for your post with the new code. That totally fixed my problem with regards to the dodgy page layout too, so thank you!!

No need to thank me.  Thank JBlaze and Fustrate.  I just figured I'd compare file since I had an older version of the mod for RC1 I think it was.  JBlaze uses different code to do the same thing in his edit there.  I just "Frankensteined" the two together to get it to look/work correctly until he has time to fix it.  It worked for me, so figured I'd post it, so he could take his time not worry about it for a bit since it does the job.

Glad it worked for you, too though!

-img removed-


droganto

Before installing I am getting an error replacing sources\subs.php it just says replace. I checked the content of what is going to replace and it look the same. Should I worry.

This is the details

7.   Execute Modification   ./Sources/Subs.php   Test failed
      1.   Replace   ./Sources/Subs.php   Test failed


FIND:
   $context['allow_admin'] = allowedTo(array('admin_forum', 'manage_boards', 'manage_permissions', 'moderate_forum', 'manage_membergroups', 'manage_bans', 'send_mail', 'edit_news', 'manage_attachments', 'manage_smileys'));


REPLACE:

   $context['allow_admin'] = allowedTo(array('admin_forum', 'manage_boards', 'manage_permissions', 'moderate_forum', 'manage_membergroups', 'manage_bans', 'send_mail', 'edit_news', 'manage_attachments', 'manage_smileys', 'manage_awards'));

Advertisement: