TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 318
  • Total: 318

Karma Blocks Package v0.4

Started by ontap, March 22, 2006, 11:43:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

antichrist

just like me, top & lower are showing fine but not the karma log function

mong0l


Redheadriot

#82
Quote from: Wartog on August 06, 2006, 07:48:56 AM
Anyone ever figure out how to make the person with the highest Karma be displayed?
mine is displaying the users with the lowest negative karma in the Topkarma block and showing the anyone with 0 karma in the lowestkarma block, if you give the person with 0 karma +1 karma it dont show him anymore.



You need to change the SSI.php file a little - back it up before you do anything, just in case.

For lowest karma, go to the section titled Lowest Karma Block and find :-


echo '<table border="0" cellpadding="0" cellspacing="3" width="100%"> ';
$karma_results = db_query("SELECT karmaGood, karmaBad, realName, ID_MEMBER FROM {$db_prefix}members ORDER BY (karmaGood-karmaBad) ASC LIMIT $lowestkarma", __FILE__, __LINE__);


Change it to :-

echo '<table border="0" cellpadding="0" cellspacing="3" width="100%"> ';
$karma_results = db_query("SELECT realName, karmaBad, ID_MEMBER FROM {$db_prefix}members ORDER BY karmaBad DESC LIMIT 5", __FILE__, __LINE__);


Then go to the section marked Top Karma block and find :-

echo '
<table border="0" cellpadding="0" cellspacing="2" width="100%"> ';
$karma_results = db_query("SELECT karmaGood, karmaBad, realName, ID_MEMBER FROM {$db_prefix}members ORDER BY (karmaGood-karmaBad) DESC LIMIT $topkarma", __FILE__, __LINE__);


Change it to :-

echo '
<table border="0" cellpadding="0" cellspacing="2" width="100%"> ';
$karma_results = db_query("SELECT realName, karmaGood, ID_MEMBER FROM {$db_prefix}members ORDER BY karmaGood DESC LIMIT 5", __FILE__, __LINE__);


Worked for me.

Edit - the above threw a couple of errors, so try this instead - btw, 5 is the number to change for however many you want to display. It doesn't work doing it through the brackets after the function this way..

//            Karma Package V0.3
//        Lowest Karma Block
//       Created By Maxâââ,¬Å¾Ã,¢ - Leave Credits!

function ssi_lowestkarma($lowestkarma = 3, $output_method = 'echo')
{
global $context, $settings, $options, $txt, $scripturl, $db_prefix;

echo '<table border="0" cellpadding="0" cellspacing="2" width="100%"> ';
$karma_results = db_query("SELECT realName, karmaBad, ID_MEMBER FROM {$db_prefix}members ORDER BY 'Bad' DESC LIMIT 1", __FILE__, __LINE__);
$context['ltkarma'] = array();

while( $row_karma = mysql_fetch_assoc($karma_results) )
{
$context['ltkarma'][] = array(
'Link' => '<span class="smalltext"><a href="' . $scripturl . '?action=profile;u=' . $row_karma['ID_MEMBER'] . '">' . $row_karma['realName'] . '</a></span>',
'Bad' => - $row_karma['karmaBad']
);
}
mysql_free_result($karma_results);

echo ' <td width="100%" valign="top"> ';

foreach($context['ltkarma'] as $ltkarma)
{
$total = $ltkarma['Bad'];
echo ' <table border="0" cellpadding="0" cellspacing="3" width="100%">
<td> '.$ltkarma['Link'].'</td>
<td width="20%" align="right"><font color="'. $txt['karma_smite_color'] .'">'.$total.'</font></td></table>';
}
echo '</td></tr></table>';
}
//              Karma Package V0.3
//              Top Karma Block
//        Created By Maxâââ,¬Å¾Ã,¢ - Leave Credits!

function ssi_topkarma($topkarma = 3, $output_method = 'echo')
{
global $context, $settings, $options, $txt, $scripturl, $db_prefix;

echo '
<table border="0" cellpadding="0" cellspacing="2" width="100%"> ';
$karma_results = db_query("SELECT realName, karmaGood, ID_MEMBER FROM {$db_prefix}members ORDER BY 'Good' DESC LIMIT 1", __FILE__, __LINE__);

$context['htkarma'] = array();

while( $row_karma = mysql_fetch_assoc($karma_results) )
{
$context['htkarma'][] = array(
'Link' => '<span class="smalltext"><a href="' . $scripturl . '?action=profile;u=' . $row_karma['ID_MEMBER'] . '">' . $row_karma['realName'] . '</a></span>',
'Good' => $row_karma['karmaGood']
);
}
mysql_free_result($karma_results);
echo '
<td width="100%" valign="top">';

foreach($context['htkarma'] as $htkarma)
{
$total = $htkarma['Good'];
echo '
<table border="0" cellpadding="0" cellspacing="3" width="100%">
<td> '.$htkarma['Link'].'</td><td width="20%" align="right"><font color="'. $txt['karma_applaud_color'] .'"> '.$total.'</font>
</td></table>';
}
echo '</td></tr></table>';
}

Max

The 'realName' is allready in the code but not at the start,
didnt think it would make a difference.. hmm will look into it more.

'karmaGood, karmaBad' - it should only be 1 or the other (not both)

Thanks For Correcting That Glampers.

rebelrose

So Maxâââ,¬Å¾Ã,¢ , if I make the above changes the karma log will work like it does on your site?

akulion

is there a way so that the wait time can be reduced to 5 mins?

or even better yet a check to see if the userAKU has given userMAX karma recently then they must wait Z number of hours before giving them karma again BUT userAKU can give other members karma in the meanwhile normally

basically once userAKU gives karma to any other user he is subject to a wait time of Z before being able to give them karma again but it does not effect his ability to give other new users karma


Avinash


Nokonium

It works fine with 1.1.1 installed as an upgrade, I don't know about installing it into 1.1.1 though.

Avinash

Quote from: nokonium on December 24, 2006, 04:43:35 PM
It works fine with 1.1.1 installed as an upgrade, I don't know about installing it into 1.1.1 though.
I've installed it in 1.1.1 and it seems to be working fine...

Max


This has being updated for 1.1.1 in my first post .. Let me know of any errors/problems  ;)

This website is proudly hosted on Crocweb Cloud Website Hosting.