Member Awards (2.0 Compatible!)

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

Previous topic - Next topic

floyd

OK... here is a weird one for you.

I have TP set up and the theme Red Darkness TP.

Everything loaded just fine, but when I am in the RD theme, I can't see the mod in the admin area.  Same in the members area.

But when I switch over to the SMF regular theme, everything is there and running just fine.

OK, I'm a NEWB at this and have gone through pages of code (none of which I understnad) to try to figure out what I need to do.

Any suggestions would be absolutely FANTASTIC!

[email protected]
http://www.werewolflive.com

salim

hi floyd

for custom theme u have to install each mod manually, u can find some usefull stuff here

http://www.simplemachines.org/community/index.php?topic=34526.msg255715#msg255715

now for this mod, all u have to make some changes in your theme files.  Those files are `index.template.php`, `Profile.template.php` & `Display.template.php`.

Q. Which codes are being replaced?
A. Unzip installation package and open `install.xml` file and make neccessary changes to your themes file (which i mention above) and thats it.

but ALWAYS MAKE BACKUP AND TEST annnnnnnnd then upload to live site.

Backup??? Yea backup of your files and db as well.

Regards,
Faisal  ;)
The second half of a man's life is made up of nothing but the habits he has acquired during the first half. - Fyodor Dostoevsky

salim

Sorry to say this, but this mod also does not work with `smf bridge`

when ever im assigning or deleting, it takes me to home page of forum, whereas it should take it to joomla home page or integrated smf forum home page.

i like this mod and i got other language translated also (in arabic and french)
but now i find this redirection issue. which i cant apply to my two sites.

regards
faisal
The second half of a man's life is made up of nothing but the habits he has acquired during the first half. - Fyodor Dostoevsky

salim

Problem Fixed...

i just fix my problem but its in orginal code... please Mr. Coder fix it..

fix need in `ManageAwards.template.php` located in `default` folder of theme,

function template_assign()
original code
<form action=', $scripturl, ' ...
Fix
<form action="', $scripturl, ' ...

function template_view_assigned()
original code
<form action=', $scripturl, ' ...
Fix
<form action="', $scripturl, ' ...

starting quot in attribute `action`is missing, after putting that quot, now is pefectly redirecting.

regrads
Faisal
The second half of a man's life is made up of nothing but the habits he has acquired during the first half. - Fyodor Dostoevsky

CraftyLion

I've just installed this mod and I'm getting this string at top of the 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.';

What does this mean?

CraftyLion

Never mind. I've worked it out ...

Zuma

#426
Hi there.

I'm here to ask anyone who can code something in php to PLEASE help me adapting this awards mod to work like the medal awards from phpBB. There's a thread here requesting the mod, but Wal-Mart has been busy for quite some time and I don't wanna bother him so much. =P

I've been checking jay's mod files and found that it's half way gone to the medal awards one, just need some adaptation:

1- allow users to recieve the same medal multiple times. It should count how many times user has recieved the medal.

2- allow admins to write a text to describe the medal when adding it in the admin section. So it would keep the "award name", "game name" and "upload award" fields, and add a new one "award description".
---- Ex. of use: "This medal is given to players who have proved exceptional value in the defense of strategic positions."

3- allow admins (or who ever has permissions to assign medals) to add a comment (reason) to the medal when assigning it to users.
---- Ex. of use: "For defending the North Bridge successfully, gloriously holding his position."

4- finally, user awards should be displayed like this in user's profile:



Could Jay or anyone else help us on it please?



Cool_Hand_Luke

How can I make this mod show my awards under the users forum posts like this:



I like the admin functions you have created, excellent work.  The mod that the image is from is another SMF Mod called "Simple Awards System Mod" located here:
http://custom.simplemachines.org/mods/index.php?mod=539

I want to use your mod because of the great admin functionality and really don't want to use the other, but I really need your mod to show my awards under users forum posts.

How can I make your mod do that or cut the coding out of the other and insert it into yours?

Any help would be greatly appreciated.

Thanks

dyota

i cannot install it because the reason is..not campatible.

i use smf 1.1.2 default theme

rowedf

Quote from: Zuma on May 07, 2007, 07:08:39 AM
Hi there.

I'm here to ask anyone who can code something in php to PLEASE help me adapting this awards mod to work like the medal awards from phpBB. There's a thread here requesting the mod, but Wal-Mart has been busy for quite some time and I don't wanna bother him so much. =P

I've been checking jay's mod files and found that it's half way gone to the medal awards one, just need some adaptation:

1- allow users to recieve the same medal multiple times. It should count how many times user has recieved the medal.

2- allow admins to write a text to describe the medal when adding it in the admin section. So it would keep the "award name", "game name" and "upload award" fields, and add a new one "award description".
---- Ex. of use: "This medal is given to players who have proved exceptional value in the defense of strategic positions."

3- allow admins (or who ever has permissions to assign medals) to add a comment (reason) to the medal when assigning it to users.
---- Ex. of use: "For defending the North Bridge successfully, gloriously holding his position."

4- finally, user awards should be displayed like this in user's profile:



Could Jay or anyone else help us on it please?




I'm with this guy, I like the suggestions and would love it if someone was able to add these features.  I also think it would be really cool to have a page that lists all the medals, description, then shows who all has that medal.

dumbelljunkie

I love the mod, and it installed without errors. I'm missing the award.gif picture in the posts however. It's in the right directory, so what could be wrong ?

I'm guessing it's in the display.template :

// Since we know this person isn't a guest, you *can* message them.
if ($context['can_send_pm'])
echo '
<a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['label'], '">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . '.gif" alt="' . $message['member']['online']['label'] . '" border="0" />' : $message['member']['online']['label'], '</a>';

// Pogo Awards
echo '
<a href="', $scripturl, '?action=profile;sa=awards;u=', $message['member']['id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['default_theme_url'] . '/images/award.gif" alt="' . $txt['awards'] . '" title="' . $txt['awards'] . '" border="0" />' : $txt['awards']), '</a>';
DisplayFieldPostsPictures();
}
}
SMF 1.1.2 Joomla 1.0.12 Bridge 1.1.7

edi67

excellent mod, now everything work, one question for you Jay

Is possible make this mod working for single user too ? i means will be nice if you can assign one award to one single user simply clicking in him account and assing it, without pass from the membergroups.

wait your reply thx
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Fustrate

#432
EDIT: I just figured it out :) Here's how to display (#) awards under a person's avatar. It's a modification of code found in... whichever file has the awards() function :D

All in Display.template.php (it all works the same anyways...)
find:
function template_main()
and add before (this is right at the top):
function show_awards_in_message($memID)
{
global $context, $db_prefix, $txt, $scripturl, $modSettings, $settings;

// How many awards to pull up?
$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'])){
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 />';
}
}


then go down a bit farther, find:
// Show their personal text?
if (!empty($settings['show_blurb']) && $message['member']['blurb'] != '')
echo '
', $message['member']['blurb'], '<br />
<br />';

add after:
show_awards_in_message($message['member']['id']);

You can actually put the second part wherever you like, but I personally like how the personal text seperates the avatar from the awards. It's also possible to make them stand out using a fieldset and a legend, which is what I did with mine.

This is why I love SMF... I get to learn while I tinker with things :D

EDIT: Fixed the error I was having with second/third/etc. pages - it was using $context['start'] when it should have used 0, and I condensed the code :)
Steven Hoffman
Former Team Member, 2009-2012

Natz

#433
Hi, i just installed this mod I have SMF 1.1.2.

I got an error when installing
Execute Modification  ./Themes/default/index.template.php  Test failed
so I edited the file manually after installing.  My problem is, is that I cant find anywhere in admin to upload or manage the awards.

Everything else seems to be there in profile, just can't  find where to do anything in admin.

Thanks for any help :D

Nat

Fustrate

There should be a Mods category added at the bottom of the side list, and Awards should be under it.

Or use ctrl-f and search for Awards on the page

Or go to http://www.yoursite.com/index.php?action=awards
Steven Hoffman
Former Team Member, 2009-2012

Natz

Thanks Yoda that link worked and i found it, but i still dont have awards on the admin page do you know of a way to fix this?

Thanks again for your help
Nat

Gararion

Is there any way to have the picture of the user's favorite award show under his avatar whenever they post?

Fustrate

From my earlier post - changed $maxAwards to 1 to just show the favorite (it'll show a random badge if they don't set a favorite)

Quote from: YodaOfDarkness on June 29, 2007, 11:25:59 PM
EDIT: I just figured it out :) Here's how to display (#) awards under a person's avatar. It's a modification of code found in... whichever file has the awards() function :D

All in Display.template.php (it all works the same anyways...)
find:
function template_main()
and add before (this is right at the top):
function show_awards_in_message($memID)
{
global $context, $db_prefix, $txt, $scripturl, $modSettings, $settings;

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

// 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'])){
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 />';
}
}


then go down a bit farther, find:
// Show their personal text?
if (!empty($settings['show_blurb']) && $message['member']['blurb'] != '')
echo '
', $message['member']['blurb'], '<br />
<br />';

add after:
show_awards_in_message($message['member']['id']);

You can actually put the second part wherever you like, but I personally like how the personal text seperates the avatar from the awards. It's also possible to make them stand out using a fieldset and a legend, which is what I did with mine.

This is why I love SMF... I get to learn while I tinker with things :D

EDIT: Fixed the error I was having with second/third/etc. pages - it was using $context['start'] when it should have used 0, and I condensed the code :)
Steven Hoffman
Former Team Member, 2009-2012

Gararion

where do I change this $maxAwards thing?

Chris369

Why do I get this stuff at the top of my page when installing this mod? I'm using 1.1.2 and default theme.



Nearly all mods make some random text appear up there and I don't know why it does it or how to solve it! Any ideas?

Advertisement: