News:

SMF 2.1.6 has been released! Take it for a spin! Read more.

Main Menu

Member Awards (2.0 Compatible!)

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

Previous topic - Next topic

poetra

Is it support for RC3 or RC5 ver?

This mod is useable,.. really nice!
I really need this one,..

Spuds

Quote from: reinnerWas this comment for me? sorry to ask such question, but i am kinda lost.
No it was not ... in your case you should uninstall the mods you installed after this mod to determine which one broke this.  Or you will have to follow this http://docs.simplemachines.org/index.php?topic=402.0 topic and see where this mods edits were changed by another mod.

Quote from: poetra on April 18, 2011, 05:04:00 AM
Is it support for RC3 or RC5 ver?
RC3 no (current version) but it works fine on RC5.  For RC5 you need to install it using emulation mode.  Upload it,  on the package browse screen go to bottom and find the "Advanced" link, and then emulate as: SMF 2.0 RC4 and install as normal.

poetra

Oke Thanks,...

I'll try it on RC5 ver using emulation mode.

Goss

Quote from: hcfwesker on April 17, 2011, 05:12:09 PM
Quote from: Goss on April 16, 2011, 11:32:04 AM
I just installed this mod on my 2.0 RC4 forum and definitely love it.  However, is there any way to change the order that awards display in on the mini-profile next to the post?  I'd like for the awards to automatically display in the same order that they show up on the awards list, but at the moment it looks like they're ordered by when they were added to the account?

I'm sure that can be changed under the portion of the sources/Load.php

ORDER BY am.favorite DESC, am.date_received DESC',

  i might take a look at it, and let you know what I find.

EDIT:::

(this is just a theory, I haven't had a chance to test it.

Under Sources/Load.php

find
ORDER BY am.favorite DESC, am.date_received DESC',

replace with
ORDER BY am.favorite DESC, am.id_award ASC',

If it doesn't change anything, just revert back to the original line, and I'll take another look at it.

That worked perfectly!  Thank you!

hcfwesker

#2244
Quote from: Goss on April 18, 2011, 07:46:51 PM
That worked perfectly!  Thank you!

Sweet!!! 

You're Welcome. :)

Also, if you're worried about too many awards piling up in the mini profile, you might like my modification to place them underneath the sigs.

http://www.simplemachines.org/community/index.php?topic=114701.msg2934038#msg2934038   <--- instructions for SMF1 , i can show for SMF2

http://www.brawldomain.com/AASMF2/index.php?topic=33.msg148#msg148  <--- preview on my test site (only tested with 1 award, but they line up side by side)

Melissa524

Is there anyway to get the awards to show up in the sig area?
In case, I forget to say.  I am using 2.0.2

poetra

#2246
I found an error when try to install it on RC5 version.

I have set it to using emulation mode but when installing I found 2 errors.

(Load.php)
Find
}
if (!empty($new_loaded_ids) && $set !== 'minimal')


Add before // I'm sorry, but I've got to stick it somewhere...
if($modSettings['awards_in_post'] > 0 && !empty($new_loaded_ids)){
$awardsRequest = $smcFunc['db_query']('', '
SELECT
aw.id_award, aw.award_name, aw.description, aw.minifile,
am.id_member, am.date_received, am.favorite
FROM {db_prefix}awards_members AS am
INNER JOIN {db_prefix}awards AS aw ON (aw.id_award = am.id_award)
WHERE am.id_member IN({array_int:members})
ORDER BY am.favorite DESC, am.date_received DESC',
array(
'members' => $new_loaded_ids,
)
);

// Fetch the award info just once
while ($row = $smcFunc['db_fetch_assoc']($awardsRequest)){
$user_profile[$row['id_member']]['awards'][] = array(
'id' => $row['id_award'],
'award_name' => $row['award_name'],
'description' => $row['description'],
'more' => '?action=profile;area=awardsMembers;id=' . $row['id_award'],
'href' => '?action=profile;area=showAwards;u=' . $row['id_member'],
'minifile' => $row['minifile'],
'img' => '/' . (empty($modSettings['awards_dir']) ? '' : $modSettings['awards_dir'] . '/') . $row['minifile'],
);
}
$smcFunc['db_free_result']($awardsRequest);
}


(Subs.php)
$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'));

there i attach the capture image.

Spuds

@poetra ... it installs on a fresh install of RC5 just fine, so the errors mean that another mod changed those areas of those files so the package manager can't find where to make the edits.

You will have to follow this http://docs.simplemachines.org/index.php?topic=402.0 topic to manually install the modification.

RAULVK

I found a small bug in Profile.template.php:

Search:
// Check if there are any awards
if (empty($context['categories']))
echo '
<p class="description>
', $txt['awards_error_no_badges'], '
</p>';



Replace:
// Check if there are any awards
if (empty($context['categories']))
echo '
<p class="description">
', $txt['awards_error_no_badges'], '
</p>';




Spuds

Thanks for the report ... I had noted that myself and corrected it in my local copy for the next update. 

bretttina

Hi

The package uploads fine and then When i click install i get this error :

"The package you are trying to download or install is either corrupt or not compatible with this version of SMF."

I'm on 2.0 RC5 With a custom theme from dzinerstudio , this one actually http://www.dzinerstudio.com/index.php?board=22.0

Any ideas guys?

Cheers

Brett.
Available Business Domains

Jorge D. Fuentes

Hi,

I'm using SMF 1.1.13, and I love the idea for member awards, so I installed this mod.
Question though: Is it possible to give members the ability to assign awards to members but not give them the ability to upload/create your own?  I cannot find this anywhere in the options.  I only see "Manage Awards" as a checkbox for permissions.

Maybe I'm not finding where to look?
-Jorge

Spuds

Quote from: bretttina on May 07, 2011, 05:56:08 AM
Hi

The package uploads fine and then When i click install i get this error :

"The package you are trying to download or install is either corrupt or not compatible with this version of SMF."

I'm on 2.0 RC5 With a custom theme from dzinerstudio , this one actually http://www.dzinerstudio.com/index.php?board=22.0

Any ideas guys?

Cheers

Brett.

You need to install it with "emulation"mode ... At the bottom of the package browse page there is an advanced button, click it, in the emulate version box enter SMF 2.0 RC4 and apply ... install the mod and then you can go back to advanced, and select revert to set it back to RC5

Spuds

Quote from: Jorge D. Fuentes on May 07, 2011, 11:32:24 AM
Hi,

I'm using SMF 1.1.13, and I love the idea for member awards, so I installed this mod.
Question though: Is it possible to give members the ability to assign awards to members but not give them the ability to upload/create your own?  I cannot find this anywhere in the options.  I only see "Manage Awards" as a checkbox for permissions.

Maybe I'm not finding where to look?
-Jorge
Yeah I don't think thats available, I'll see if I can add that in the next release, whenever that is (but it will happend :) )

BaghdadGhost

Quote from: callteg4 on August 31, 2008, 12:28:05 AM
Quote from: YodaOfDarkness on July 06, 2007, 09:11:42 PM
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 :)

Thanks alot been trying to do this for a while


this does not work for smf2 rc4  :'(   any help plz I want to preview the awards big images under the signature 

bretttina

Thanks got it now but it is throwing up a few errors , and telling me not to proceed!

is this because of my theme?
Available Business Domains

Spuds

Quote from: bretttina on May 09, 2011, 08:18:31 AM
Thanks got it now but it is throwing up a few errors , and telling me not to proceed!

is this because of my theme?
Most likely that is the cause ... if the errors you are seeing are only on Display.template.php then you will have to manually make the changes to that file as the package manager can't find where to do it ... see this for some tips.

http://www.simplemachines.org/community/index.php?topic=114701.msg3015126#msg3015126

BaghdadGhost

does anyone have an answer to my question ?

thanks

venex

Quote from: BaghdadGhost on May 10, 2011, 02:01:51 AM
does anyone have an answer to my question ?

thanks
U just said that it's not working (I have RC4 and it works just fine).. can u at least say why it isnt working for you? Any displayed error or something?

Melissa524

I am going to re ask my question?  Do you think there is anyway that awards could be shown in the sig?
In case, I forget to say.  I am using 2.0.2

Advertisement: