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

Stigmartyr

Quote from: JayBachatero on October 01, 2006, 01:26:33 PM
Ok in Display.php find

mysql_free_result($request);
$posters = array_unique($posters);


Add after

// Load the members awards
$awards_request = db_query("
SELECT pab.filename, pam.ID_MEMBER
FROM {$db_prefix}awards_members AS pam
LEFT JOIN {$db_prefix}awards AS pab ON (pab.ID_AWARD = pam.ID_AWARD)
WHERE pam.ID_MEMBER IN (" . implode(', ', $posters) . ")
AND pam.favorite = 1
GROUP BY pam.ID_MEMBER", __FILE__, __LINE__);

$context['awards'] = array();
while ($row = mysql_fetch_assoc($awards_request))
$context['awards'][$row['ID_MEMBER']] = '<img src="' . dirname($scripturl) . '/' . (empty($modSettings['pa_awardsDir']) ? '' : $modSettings['pa_awardsDir'] . '/') . $row['filename'] . '" alt="' . $row['filename'] . '" />';

mysql_free_result($awards_request);



In Display.template.php find

// Show avatars, images, etc.?
if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
echo '
<div style="overflow: auto; width: 100%;">', $message['member']['avatar']['image'], '</div><br />';



Add after

// Show the fav award
if (isset($context['awards'][$message['member']['id']]))
echo '
<div style="overflow: auto; width: 100%;">', $context['awards'][$message['member']['id']], '</div><br />';



I didn't test this out so not sure if it's going to fully work.  It should work though.


Hi Jay - thanks for the great mod - Ive followed your instructions and edited my Sources/Display.php files and default/display.template.php files as above.  However I see no change whatsoever.  No badges or awards are presented under posts (Signature area).  I am using another theme other than default.  Is there something more I should do?  Also I am using TinyPortal.

JayBachatero

Check to see if your custom theme has a custom Display.template.php.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Stigmartyr

#302
It does not.  Further, adding a copy of the modified display template does nothing ...

See post example with modified pages: http://black-chapter.com/forums/index.php?topic=2148.msg20791#msg20791

Attached are the files I am using (modded)

JayBachatero

Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

computel

I'm using the default theme and I don't see the image beside the users name.

Stigmartyr

Quote from: JayBachatero on January 16, 2007, 09:31:43 PM
Try using the default theme and check if you can see it.
http://black-chapter.com/forums/index.php?topic=2148.msg20791;theme=1

Tried that too per your previous posts and no change

nipun_jain

I installed this mod in smf 1.1 rc3 and get this error in the admin section of the mod

Database Error
Unknown column 'awardName' in 'field list'
File: /home/xyz/public_html/Sources/ManageAwards.php
Line: 193

Threepwud

Hi!

I was wondering whether anyone could help... I have 1.1.1 of the forum and had tried to install this mod again. It didn't show any errors so I proceeded. But now I get the follwing text as an error at the top of my page:
// 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 Awards.';

I uninstalled the mod but this stays. Any advice or help please? MUCH appreciated!

Thanks - hldrforum.com to see the problem.

iMóH.1

Hello Jay, your Mod is awesome!
But i have two important questions! How do i make your mod work on german SMF language file and on PnPn custom theme?
I would be very grateful for fast support. :)

tavoo

Quote from: Stigmartyr on January 16, 2007, 02:34:18 PM
Quote from: JayBachatero on October 01, 2006, 01:26:33 PM
Ok in Display.php find

mysql_free_result($request);
$posters = array_unique($posters);


Add after

// Load the members awards
$awards_request = db_query("
SELECT pab.filename, pam.ID_MEMBER
FROM {$db_prefix}awards_members AS pam
LEFT JOIN {$db_prefix}awards AS pab ON (pab.ID_AWARD = pam.ID_AWARD)
WHERE pam.ID_MEMBER IN (" . implode(', ', $posters) . ")
AND pam.favorite = 1
GROUP BY pam.ID_MEMBER", __FILE__, __LINE__);

$context['awards'] = array();
while ($row = mysql_fetch_assoc($awards_request))
$context['awards'][$row['ID_MEMBER']] = '<img src="' . dirname($scripturl) . '/' . (empty($modSettings['pa_awardsDir']) ? '' : $modSettings['pa_awardsDir'] . '/') . $row['filename'] . '" alt="' . $row['filename'] . '" />';

mysql_free_result($awards_request);



In Display.template.php find

// Show avatars, images, etc.?
if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
echo '
<div style="overflow: auto; width: 100%;">', $message['member']['avatar']['image'], '</div><br />';



Add after

// Show the fav award
if (isset($context['awards'][$message['member']['id']]))
echo '
<div style="overflow: auto; width: 100%;">', $context['awards'][$message['member']['id']], '</div><br />';



I didn't test this out so not sure if it's going to fully work.  It should work though.


Hi Jay - thanks for the great mod - Ive followed your instructions and edited my Sources/Display.php files and default/display.template.php files as above.  However I see no change whatsoever.  No badges or awards are presented under posts (Signature area).  I am using another theme other than default.  Is there something more I should do?  Also I am using TinyPortal.

I modified these files and it works great.

But one thing, in users posts, there is no number of awards data listed.. anyone know the code to fix this?

TechnoDragon

Don't tell me to get into shape...I have a shape...It is round!


tavoo

Quote from: TechnoDragon on January 20, 2007, 10:59:37 AM
http://www.simplemachines.org/community/index.php?topic=114701.msg790701#msg790701

the code for that was posted in that reply

Yep.. tried that.. Nothign happens.. Updated the load and display files..

TechnoDragon

// Show number of awards
echo '
<a href="', $scripturl, '?action=profile;sa=awards;u=', $message['member']['id'], '">Total Awards</a>: ', !empty($message['member']['awards']) ? $message['member']['awards'] : 0, '<br />
<br />';


Try that instead
Don't tell me to get into shape...I have a shape...It is round!


tavoo

Quote from: TechnoDragon on January 20, 2007, 11:03:07 AM
// Show number of awards
echo '
<a href="', $scripturl, '?action=profile;sa=awards;u=', $message['member']['id'], '">Total Awards</a>: ', !empty($message['member']['awards']) ? $message['member']['awards'] : 0, '<br />
<br />';


Try that instead

That worked!!  You are the man!!!

TechnoDragon

The problem was in the original code i posted I used a $txt string (modified the language template) so it was translation compatible...that is why it wasn't showing up at first...
Don't tell me to get into shape...I have a shape...It is round!


TechnoDragon

just look for the code referring to the avatar and place it right below that
Don't tell me to get into shape...I have a shape...It is round!


tavoo

Thanks again man..

As for anyone that wants to move that to below their avatar and above their actual reward, just move that script before the show avatar one right below it.

TechnoDragon

Anytime!

I love to help when i can!
Don't tell me to get into shape...I have a shape...It is round!


JayBachatero

Quote from: nipun_jain on January 17, 2007, 06:05:20 AM
I installed this mod in smf 1.1 rc3 and get this error in the admin section of the mod

Database Error
Unknown column 'awardName' in 'field list'
File: /home/xyz/public_html/Sources/ManageAwards.php
Line: 193
Make sure that the database got created correctly.

Quote from: Threepwud on January 17, 2007, 09:26:12 PM
Hi!

I was wondering whether anyone could help... I have 1.1.1 of the forum and had tried to install this mod again. It didn't show any errors so I proceeded. But now I get the follwing text as an error at the top of my page:
// 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 Awards.';

I uninstalled the mod but this stays. Any advice or help please? MUCH appreciated!

Thanks - hldrforum.com to see the problem.
Open Modifications.english.php.  Move the language strings that are after the ?> before the ?>

Quote from: iMóH.1 on January 18, 2007, 07:19:43 AM
Hello Jay, your Mod is awesome!
But i have two important questions! How do i make your mod work on german SMF language file and on PnPn custom theme?
I would be very grateful for fast support. :)
You would need to translate the mod to German.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Stigmartyr

Still not able to get the awards mod to work on my site and pull in ALL assigned awards into the signature area (after post).

I am going to have to remove this mod and consider another option if no solution is forthcoming.  Jay, can you help me to get this working please?

Advertisement: