Member Awards (2.0 Compatible!)

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

Previous topic - Next topic

Fustrate

// Show the fav award
if (isset($context['awards'][$message['member']['id']])) {
echo '
                                                                 <div style="overflow: auto; width: 100%;">';
$count = 0;
foreach ($context['awards'][$message['member']['id']] as $badge){
$count++;
echo '
                                                                          ', $badge;
if($count == 5)
echo '<br />';
}
echo '
                                                                           </div><br />';
}

echo '
</td>
</tr>
</table>
</td></tr>
</table>
</td></tr>';
}

:)
Steven Hoffman
Former Team Member, 2009-2012

DOOM666

#661
that didn work it took all but 1 badge away

see post below.

Fustrate

It shouldn't have... did you paste directly from my post?
Steven Hoffman
Former Team Member, 2009-2012

DOOM666

it works know i dont what happend the first time thanks for your help worked liked a charm

d58e7

Where would I insert that database query code in profile.php for that code to work in profile.template.php?

Fustrate

What are you aiming to do? I don't quite understand your question.
Steven Hoffman
Former Team Member, 2009-2012

mercadia

It me again shouldn't there be a link in members profile to view awards ? If not what do I need to do to put one there ?

d58e7

Quote from: YodaOfDarkness on July 21, 2008, 12:19:17 AM
What are you aiming to do? I don't quite understand your question.
I'm really trying to have 3 of the member's awards show up directly on the first profile page with a link to the rest of the awards.

Fustrate

That's pretty much the same code as I posted a long while ago (around page... 23?), I'll see if I can clean it up for the profile.
Steven Hoffman
Former Team Member, 2009-2012

mercadia

Quote from: YodaOfDarkness on July 21, 2008, 09:48:29 PM
That's pretty much the same code as I posted a long while ago (around page... 23?), I'll see if I can clean it up for the profile.
was that aimed at me or d58e7 ? Looked on pages 22-25 seemed to be about fav awards and other bugs.... This Mod is loved by my community top job :)

fastman

1. Execute Modification ./index.php Test successful
2. Execute Modification ./Sources/Profile.php Test successful
3. Execute Modification ./Sources/Who.php Test successful
4. Execute Modification ./Sources/Admin.php Test failed
5. Execute Modification ./Sources/Subs.php Test successful
6. Execute Modification ./Sources/ManagePermissions.php Test successful
7. Execute Modification ./Themes/default/index.template.php Test successful
8. Execute Modification ./Themes/default/Profile.template.php Test successful
9. Execute Modification ./Themes/default/Display.template.php Test successful
10. Execute Modification ./Themes/default/languages/Modifications.english.php Test successful
11. Execute Modification ./Themes/default/languages/ManagePermissions.english.php Test successful
12. Execute Modification ./Themes/default/languages/Errors.english.php Test successful
13. Extract File ./Sources/ManageAwards.php 
14. Extract File ./Themes/default/ManageAwards.template.php 
15. Extract File ./Themes/default/languages/ManageAwards.english.php 
16. Extract File ./Themes/default/images/award.gif 
17. Create Tree ./awards 
18. Execute Code install.php


could you please tell me whats wrong/ how i could fix this? thanks (its saying test unsuccessful for admin.php

Fustrate

You'll have to make the edits for Sources/Admin.php by hand. It's very simple - find this:
isAllowedTo(array('admin_forum', 'manage_permissions', 'moderate_forum', 'manage_membergroups', 'manage_bans', 'send_mail', 'edit_news', 'manage_boards', 'manage_smileys', 'manage_attachments'
and replace it with
isAllowedTo(array('admin_forum', 'manage_permissions', 'moderate_forum', 'manage_membergroups', 'manage_bans', 'send_mail', 'edit_news', 'manage_boards', 'manage_smileys', 'manage_attachments', 'manage_awards'
Replace that EXACT portion - there's probably more on that same line, but leave it as-is (it's probably just an ending ));)

In regards to a few of the requests - I'm sorry that I haven't been able to handle these in a timely manner (I like to do things within 24 hours), but I'm pretty busy updating this mod to work with SMF 2.0. More features are being added such as award categories, and some of the little changes people requested/posted are being added into the default package.

After I finish, I'll work on posting a new version for 1.1.x, which will include a few of the "missing" features added manually over time. This might take a little while, but as soon as this modification is switched over to my name I'll begin fully supporting it along with my other two mods.
Steven Hoffman
Former Team Member, 2009-2012

Mother Goose

You are a constant, dependable, attendant to this mod Dear Yoda.. no apologies required.
   

Fustrate

Thanks :) I'm going to bed now, seeing as I've been late to work the last two days and I haven't been getting much sleep. I'm going to finish up the coding on the 2.0 version tomorrow afternoon, whereupon I can start on the improvements to the original version.

Heh, a few days ago Jay told me that this wasn't even supposed to ever be released as a mod, but I'm sure glad he did :D
Steven Hoffman
Former Team Member, 2009-2012

Mother Goose

Sleep!!

YES!! This mod is the hub of our forum! In a thousand ways. Your hard work does not go unnoticed.
   

mercadia

#675
I am forum admin and even I can't see view awards album link on a members profile(see screenshot) Anyhelp would be appreciated :)


Thank you that fixed it :)

Fustrate

Reply was just sent to your PMs.

As a note, the edits hadn't gone through on Modifications.english-utf8.php, nor any other -utf8 language file.

For UTF8:
Upload a copy of ManageAwards.english.php to your language dir with the name ManageAwards.english-utf8.php
Make all theme edits to the utf8 versions of these files:

$languagedir/Modifications.english.php
Find ?> and place this before it:
// Pogo Awards adminIndex text strings.
$txt['awards'] = 'Awards';
$txt['pa_view_album'] = 'View member\'s badge album.';
$txt['pa_mods'] = 'Mods';
$txt['whoallow_pogoawards'] = 'Managing <a href="' . $scripturl . '?action=awards">Awards</a>.';


$languagedir/ManagePermissions.english.php
Find ?> and place this before it:
// Pogo Awards permissions.
$txt['permissionname_manage_awards'] = 'Manage Awards';
$txt['permissionhelp_manage_awards'] = 'This will allow users add. edit and assign new awards';


$languagedir/Errors.english.php
Find this line:
$txt['cannot_calendar_view'] = 'Sorry, but you are not allowed to view the calendar.';
Add this after it:
$txt['cannot_manage_awards'] = 'You are not allowed to manage Awards.';
Steven Hoffman
Former Team Member, 2009-2012

d58e7

I'm getting this error with the code on page 22/23

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3 File: /public_html/forum/Sources/Load.php(1876) : eval()'d code
Line: 17

Fustrate

Can you show me what is around line 17 in Load.php?

about five lines either way
Steven Hoffman
Former Team Member, 2009-2012

d58e7

#679
I think that was part of the error I had threw some code in load, now that I have removed it that error's gone but I get.

Database Error
Please try again. If you come back to this error screen, report the error to an administrator.

Edit: I used this code.

function show_awards_in_message($memID)
{
   global $context, $db_prefix, $txt, $scripturl, $modSettings, $settings;

   // How many awards to pull up? 1 for Favorite
   $maxAwards = 4;

   // Count the number of items in the database for create index
   $request = db_query("
      SELECT COUNT(*)
      FROM {$db_prefix}awards_members
      WHERE ID_MEMBER = $memID", __FILE__, __LINE__);
   list ($countAM) = mysql_fetch_row($request);
   mysql_free_result($request);

   // The count of awards per member
   $context['countAwards'] = $countAM;

   // Load the awards
   $awardsSelect = db_query("
      SELECT
         aw.ID_AWARD, aw.awardName, aw.gameName, aw.filename, aw.width, aw.height,
         am.ID_MEMBER, am.dateReceived, am.favorite
      FROM {$db_prefix}awards AS aw
         LEFT JOIN {$db_prefix}awards_members AS am ON (am.ID_AWARD = aw.ID_AWARD)
      WHERE am.ID_MEMBER = $memID
      ORDER BY am.favorite DESC, am.dateReceived DESC
      LIMIT 0, $maxAwards", __FILE__, __LINE__);

   // Set the $context['awards'] var
   $context['awards'] = array();

   // Fetch the award info just once
   while ($row = mysql_fetch_assoc($awardsSelect))
   {
      $context['awards'][$row['ID_AWARD']] = array(
         'id' => $row['ID_AWARD'],
         'awardName' => $row['awardName'],
         'gameName' => $row['gameName'],
         'more' => $scripturl . '?action=profile;sa=awardsMembers;id=' . $row['ID_AWARD'],
         'favorite' => array(
            'fav' => $row['favorite'],
            'href' => $scripturl . '?action=profile;sa=awards;id=' . $row['ID_AWARD'] . ';makeFavorite=' . ($row['favorite'] == 1 ? '0' : '1') . (isset($_REQUEST['u']) ? ';u=' . $_REQUEST['u'] : ''),
            'img' => '<img src="' . $settings['images_url'] . '/' . ($row['favorite'] == 1 ? 'collapse' : 'expand') . '.gif" alt="' . $txt['pa_favorite'] . '" />',
         ),
         'filename' => $row['filename'],
         'width' => $row['width'],
         'height' => $row['height'],
         'time' => list ($year, $month, $day) = sscanf($row['dateReceived'], '%d-%d-%d'),
         'img' => dirname($scripturl) . '/' . $modSettings['pa_awardsDir'] . '/' . $row['filename'],
      );
   }
   mysql_free_result($awardsSelect);

if (!empty($context['awards'])){
echo '
<fieldset style="border: 1px solid black; -moz-border-radius: 8px;">
<legend>Favorite Award</legend>
';
   foreach ($context['awards'] as $award){
      echo '<a href="', $award['more'], '"><img src="', $award['img'], '" width="', $award['width'], '" height="', $award['height'], '" alt="', $award['awardName'], '" title="', $award['awardName'], '" /></a> ';
   }
   echo '<br />
<br />';
echo '
</fieldset>';
}
}


and

show_awards_in_message($message['member']['id']);

Advertisement: