TinyPortal

Development => Block Codes => Topic started by: ontap on March 22, 2006, 11:43:17 AM

Title: Karma Blocks Package v0.4
Post by: ontap on March 22, 2006, 11:43:17 AM
Here's A Karma Mod For Use With SMF & Of Course Tinyportal  :)

Install Via Package Manager....

3 Different Karma Blocks Based On Your Forum Members
Karma Log, Top Karma & Lowest Karma Using SSI.

NOTE: Karma Must Be Enabled On Your Forum For These Blocks To Work.

Download V0.4 Here! (http://www.tinyportal.net/index.php?action=tpmod;dl=item637)

V.04 Changes:
Fixed Package Installer For SMF 1.1 Final & SMF 1.1.1
Fixed Lowest Karma SQL Code - This May Give Problems Depending On SQL Version?

Tested With SMF 1.1.1 Final & 1.1.1 With Tinyportal v9
Not Tested On SMF 1.0.8 Or Lower

Use Php Block For Each Karma Block...

Karma Log
ssi_karmalog();
Lowest Karma
ssi_lowestkarma();
Top Karma
ssi_topkarma();

Please remember to backup your SSI.php file before you try this mod.

comments, ideas welcome  :coolsmiley:

Demo Of Blocks @  http://TheGaff.net/Forums
Title: Re: Karma Blocks Package v0.3
Post by: G6Cad on March 22, 2006, 11:48:37 AM
Just downloaded the zipfile from the first link, and the file is empty  :o
Title: Re: Karma Blocks Package v0.3
Post by: ontap on March 22, 2006, 11:49:37 AM
yeah gota wait for bloc to change that..
Title: Re: Karma Blocks Package v0.3
Post by: Nokonium on March 22, 2006, 12:35:02 PM
Thanks OnTap, that was quick. I'd asked about a Karma SSI over on SMF but didn't get a reply over there.

I've installed it via the package manager, have high and low working in Fiddlers Elbow but I dont seem to have anything showing for the log.
Title: Re: Karma Blocks Package v0.3
Post by: ontap on March 22, 2006, 12:39:00 PM
Quote from: nokonium on March 22, 2006, 12:35:02 PM
but I dont seem to have anything showing for the log.

strange... do you get an error in the error log?
Title: Re: Karma Blocks Package v0.3
Post by: Nokonium on March 22, 2006, 12:49:11 PM
Nothing related to the SSI.
Title: Re: Karma Blocks Package v0.3
Post by: ontap on March 22, 2006, 12:56:50 PM
Quote from: nokonium on March 22, 2006, 12:49:11 PM
Nothing related to the SSI.

can you test it on another webiste?, will wait to see if others have the same prob...
Title: Re: Karma Blocks Package v0.3
Post by: Nokonium on March 22, 2006, 01:02:11 PM
That is my only test site with TP & Karma and I don't want to try it on the main site yet, lets see what others find.
Title: Re: Karma Blocks Package v0.3
Post by: elpvn on March 22, 2006, 01:02:16 PM
Thanks OnTapÂÃ,© ! I'd love mod  ;)
Title: Re: Karma Blocks Package v0.3
Post by: Nokonium on March 22, 2006, 01:07:31 PM
If you want to tweak the format a bit, say to match the User or Online blocks, try something like this

echo '<div style="padding: 5px;" class="smalltext">';
         ssi_topkarma();
         echo '</div>';


or whatever style class you want.
Title: Re: Karma Blocks Package v0.3
Post by: elpvn on March 22, 2006, 01:12:46 PM
Thank nokonium 2  ;D
Title: Re: Karma Blocks Package v0.3
Post by: alan s on March 22, 2006, 01:19:16 PM
works really well!!!!!!!! thanks, i've been looking for something like this for ages, what i'd like to do though is have the karma log on a seperate page with a link to it on the nav bar. Any ideas on how to do this?
Title: Re: Karma Blocks Package v0.3
Post by: Nokonium on March 22, 2006, 01:30:40 PM
I've just double checked everything, PHP block, function name.

Here is the relevent section of SSI.php

// Latest Karma Block For Use With TinyPortal
// Created By OnTap - Leave Credits!

function ssi_karmalog()
{
global $context, $settings, $options, $txt, $scripturl, $db_prefix;

echo '
<table border="0" cellpadding="0" cellspacing="3" width="100%">
<tr>';

        $karma_result = db_query("
                SELECT lk.ID_TARGET, lk.ID_EXECUTOR, lk.logTime, lk.action, memt.realName AS targetName, meme.realName AS executorName, meme.ID_MEMBER as executorID, memt.ID_MEMBER as targetID
                FROM {$db_prefix}log_karma AS lk, {$db_prefix}members AS memt, {$db_prefix}members AS meme
                WHERE memt.ID_MEMBER = lk.ID_TARGET
                        AND meme.ID_MEMBER = lk.ID_EXECUTOR
                ORDER BY logTime DESC
                LIMIT 05", __FILE__, __LINE__);
        $return = array();
        while ($row_karmas = mysql_fetch_assoc($karma_result))
        {
                $return[] = array(
                        'executor' => $row_karmas['executorName'],
                        'executorID' => $row_karmas['executorID'],
                        'target' => $row_karmas['targetName'],
                        'targetID' => $row_karmas['targetID'],
                        'action' => $row_karmas['action'] == 1 ? '<font color=green>Applauds' : '<B><font color=#FF0000>Smites</B>',
                        'time' => timeformat($row_karmas['logTime'])
                );
        }
        mysql_free_result($karma_result);

        echo '
                                        <td width="100%" valign="top">';
        foreach ($return as $data)
           echo '<span class="smalltext"><a href=', $scripturl, '?action=profile;u=', $data['executorID'], '><font color=#000000>', $data['executor'], '</font></a> ', $data['action'], ' <a href=', $scripturl, '?action=profile;u=', $data['targetID'], '>', $data['target'], '</a></font><br> ', $data['time'], '<hr> ';

        echo '
                                        </td>
                                </tr>
                        </table>';
}
Title: Re: Karma Blocks Package v0.3
Post by: G6Cad on March 22, 2006, 01:41:45 PM
Got it working :)
Thanks a lot for this snippet OnTapÂÃ,©
Title: Re: Karma Blocks Package v0.3
Post by: Nokonium on March 22, 2006, 02:23:02 PM
Supplementary info

Webhost php version is 5.1
Title: Re: Karma Blocks Package v0.3
Post by: ontap on March 22, 2006, 02:25:03 PM
Quote from: nokonium on March 22, 2006, 02:23:02 PM
Supplementary info

Webhost php version is 5.1

ive tested it on 3 sites and it works perfect...
try Applaudin a few people and see does it show up?
Title: Re: Karma Blocks Package v0.3
Post by: Nokonium on March 22, 2006, 02:55:25 PM
Our karma is set to totals and admin only, there are no applaud or smite links to use. We 'award' our karma by changing the plus/applaud total in the users profile. I have done that and the revised total shows, but the log didn't register anything. 
Title: Re: Karma Blocks Package v0.3
Post by: Xarcell on March 24, 2006, 02:55:50 PM
Ultra Cool, thanks a TON dude...
Title: Re: Karma Blocks Package v0.3
Post by: Chodhry on March 24, 2006, 08:51:59 PM
How do you get this thing working? I dont see any block option added in SSI function. From where I can add this block on my site?

Thanks!
Chodhry

http://www.WebmasterTradeCenter.com
Title: Re: Karma Blocks Package v0.3
Post by: ontap on March 24, 2006, 08:56:10 PM
Quote from: Chodhry on March 24, 2006, 08:51:59 PM
How do you get this thing working? I dont see any block option added in SSI function. From where I can add this block on my site?

you gota add a php block for each and insert the codes below

Karma Log
ssi_karmalog();
Lowest Karma
ssi_lowestkarma();
Top Karma
ssi_topkarma();
Title: Re: Karma Blocks Package v0.3
Post by: Chodhry on March 24, 2006, 08:59:38 PM
oh, ok, thanks a million. :)
Title: Re: Karma Blocks Package v0.3
Post by: alan s on March 25, 2006, 10:57:21 AM
Quote from: Alan S on March 22, 2006, 01:19:16 PM
works really well!!!!!!!! thanks, i've been looking for something like this for ages, what i'd like to do though is have the karma log on a seperate page with a link to it on the nav bar. Any ideas on how to do this?
Any Ideas Anyone?
Title: Re: Karma Blocks Package v0.3
Post by: Nokonium on March 25, 2006, 11:39:02 AM
Put the Karma log block code into a php article and link to it through the menu.
Title: Re: Karma Blocks Package v0.3
Post by: alan s on March 25, 2006, 12:22:33 PM
thank you!!!!!!!!
Title: Re: Karma Blocks Package v0.3
Post by: ontap on March 26, 2006, 04:13:21 AM

needed to fix up a few things in the mod, will post update later...
Title: Re: Karma Blocks Package v0.3
Post by: Defile on March 27, 2006, 05:09:30 PM
I installed it and tested it everything works great for me. But there is one thing I'd like to change, In the karma log where it says:

Name1 Applauds Name2 for example.

Name1's font color is in black, and I use a dark theme so it makes it really hard to read. All the other names just come up fine as the forum default colors.

If someone could tell me where to edit it so I can Change the font color of Name1 that would be great ;)

Thanks
Title: Re: Karma Blocks Package v0.3
Post by: RoarinRow on March 27, 2006, 05:13:16 PM
How many entries will the log keep and is there a way to set it so you one see the last 20 Karmas?
Title: Re: Karma Blocks Package v0.3
Post by: G6Cad on March 27, 2006, 05:41:03 PM
I guess you can change the number to show.

Try this ( havent tryed it myselfe though so backup the files before you try this)

In theme dir ssi.php find
LIMIT 05", __FILE__, __LINE__); Change the 05 to 20

SELECT karmaGood, karmaBad, realName, ID_MEMBER FROM {$db_prefix}members ORDER BY (karmaGood-karmaBad) ASC LIMIT 5", __FILE__, __LINE__); change 05 to 20

SELECT karmaGood, karmaBad, realName, ID_MEMBER FROM {$db_prefix}members ORDER BY (karmaGood-karmaBad) DESC LIMIT 5", __FILE__, __LINE__); Change 5 to 20


I hope that will work :)

Title: Re: Karma Blocks Package v0.3
Post by: ontap on March 27, 2006, 06:03:29 PM
Quote from: G6 on March 27, 2006, 05:41:03 PM
Try this ( havent tryed it myselfe though so backup the files before you try this)

I hope that will work :)


the old way of changing it  :P this has being fixed in the new version.

V0.2
See Attachment In First Post
http://www.tinyportal.net/smf/index.php?topic=3630.msg29944#msg29944

Quote from: RoarinRow on March 27, 2006, 05:13:16 PM
is there a way to set it so you one see the last 20 Karmas?

Yeah, Download 0.2 & if you wanna show 20 in the karma log put it ssi_karmalog(20);
Title: Re: Karma Blocks Package v0.3
Post by: G6Cad on March 27, 2006, 06:05:04 PM
Well, i did give it a try though ;)  :2funny:
Title: Re: Karma Blocks Package v0.3
Post by: RoarinRow on March 27, 2006, 09:29:03 PM
Quote from: OnTapÂÃ,© on March 27, 2006, 06:03:29 PM
Quote from: G6 on March 27, 2006, 05:41:03 PM
Try this ( havent tryed it myselfe though so backup the files before you try this)

I hope that will work :)


the old way of changing it  :P this has being fixed in the new version.

V0.2
http://thegaff.net/forums/index.php?action=tpmod;dl=item18

Quote from: RoarinRow on March 27, 2006, 05:13:16 PM
is there a way to set it so you one see the last 20 Karmas?

Yeah, Download 0.2 & if you wanna show 20 in the karma log put it ssi_karmalog(20);

Cool, thanks!
Title: Re: Karma Blocks Package v0.3
Post by: RoarinRow on March 27, 2006, 10:03:19 PM
This is interesting.  I installed v.2 on my test site. Look at the first user.  He has -1, but he shows up in the Top Karma block. 

I have Total Karma enabled instead of Positive/negative Karma.

Title: Re: Karma Blocks Package v0.3
Post by: G6Cad on March 27, 2006, 10:45:01 PM
Perhaps it counts it backwards? like the negative numbers comes out first cause it counts before the actuall first numer

-1 0 1 etc...
Title: Re: Karma Blocks Package v0.3
Post by: ontap on March 28, 2006, 10:48:30 AM
Quote from: RoarinRow on March 27, 2006, 10:03:19 PM
Look at the first user.  He has -1,

very strange is right....

try changing that members karma and see will it change it?
Title: Re: Karma Blocks Package v0.3
Post by: Nokonium on March 28, 2006, 01:11:58 PM
I uninstalled 0.1 before I installed 0.2 and all my admin disappeared, all I had was the sidebar. So I reloaded the 0.1 karma SSI file and ran it as an update. When I checked the SSI file it had both 0.1 & 0.2 code.

I've edited it now to only 0.2 code, what is the correct task order to update from 0.1 to 0.2?
Title: Re: Karma Blocks Package v0.3
Post by: ontap on March 28, 2006, 01:15:28 PM
Quote from: nokonium on March 28, 2006, 01:11:58 PM
I uninstalled 0.1 before I installed 0.2 and all my admin disappeared

Disable the karma blocks first... then uninstall.
Title: Re: Karma Blocks Package v0.3
Post by: Nokonium on March 28, 2006, 01:29:28 PM
Thanks
Title: Re: Karma Blocks Package v0.3
Post by: Xarcell on March 31, 2006, 02:03:15 AM
Quote from: RoarinRow on March 27, 2006, 10:03:19 PM
This is interesting.  I installed v.2 on my test site. Look at the first user.  He has -1, but he shows up in the Top Karma block. 

I have Total Karma enabled instead of Positive/negative Karma.

There is a solution for this somewhere at the SMF boards. It also happened when someone created a mod that displayed karma stats on stat page. I believe it may have been in the trips & tricks, I can't remember.
Title: Re: Karma Blocks Package v0.3
Post by: londonhogfan on April 10, 2006, 11:11:44 PM
has anyone found this?  I will be looking too.
Title: Re: Karma Blocks Package v0.3
Post by: ontap on April 11, 2006, 05:33:40 AM
Quote from: londonhogfan on April 10, 2006, 11:11:44 PM
has anyone found this?  I will be looking too.

dont understand what you mean, the mod is attached at the start of this topic?
Title: Re: Karma Blocks Package v0.3
Post by: londonhogfan on April 11, 2006, 02:43:06 PM
This is what I was talking about.

Quote from: Xarcell on March 31, 2006, 02:03:15 AM
Quote from: RoarinRow on March 27, 2006, 10:03:19 PM
This is interesting.  I installed v.2 on my test site. Look at the first user.  He has -1, but he shows up in the Top Karma block. 

I have Total Karma enabled instead of Positive/negative Karma.

There is a solution for this somewhere at the SMF boards. It also happened when someone created a mod that displayed karma stats on stat page. I believe it may have been in the trips & tricks, I can't remember.

I did find a couple of topics that brought it up, but no one ever had a solution for it....
Title: Re: Karma Blocks Package v0.3
Post by: Mitchâ„¢ on April 11, 2006, 11:52:10 PM
How do I make it only display the member with the most karma.

I only want one person displayed.

Would my php code look like this?

echo '<div style="padding: 5px;" class="smalltext">';
         ssi_topkarma(1);
         echo '</div>';


Title: Re: Karma Blocks Package v0.3
Post by: ontap on April 12, 2006, 12:49:47 AM
Quote from: Mitchâââ,¬Å¾Ã,¢ on April 11, 2006, 11:52:10 PM

I only want one person displayed.

Would my php code look like this?

echo '<div style="padding: 5px;" class="smalltext">';
         ssi_topkarma(1);
         echo '</div>';


yup.
Title: Re: Karma Blocks Package v0.3
Post by: than on May 05, 2006, 11:45:19 AM
Hi, i ÂÃ,´m from spain, sorry for my english.

My karma log, restarts to empty after x time.

How can i make the loog permanent?

Thanks  ^-^
Title: Re: Karma Blocks Package v0.3
Post by: than on May 05, 2006, 04:53:54 PM
New thing, the log restarts when after x minute’s one member makes new karma assignment.

Please can anyone’s help me?
Title: Re: Karma Blocks Package v0.3
Post by: IchBin on May 05, 2006, 08:55:55 PM
I would post your questions over at SMF.
Title: Re: Karma Blocks Package v0.3
Post by: alan s on May 13, 2006, 01:02:16 PM
is there anyway to show it to time? say karma action in the last 24 or 48 hrs?
Title: Re: Karma Blocks Package v0.3
Post by: navjotjsingh on May 29, 2006, 02:04:54 PM
karma log does not work here.. lowest and highest karma codes work though.

SMF 1.1RC2 and TinyPortal 0.8.6
Title: Re: Karma Blocks Package v0.3
Post by: Avinash on June 19, 2006, 12:12:10 AM
Hey, has anyone figured out how to solve the problem of negative Karma showing up as #1 in the Leader block? I searched over at SMF but couldnt figure it out.
Title: Re: Karma Blocks Package v0.3
Post by: vulcan on June 20, 2006, 05:33:20 AM
Package Manager - Install Actions
Install Actions for archive KarmaBlocks02.zip:
The package you are trying to download or install is either corrupt or not compatible with this version of SMF
O_o
Title: Re: Karma Blocks Package v0.3
Post by: Max on June 20, 2006, 07:52:48 AM
Quote from: vulcan on June 20, 2006, 05:33:20 AM
The package you are trying to download or install is either corrupt or not compatible with this version of SMF

what version of SMF are you tryin to install it on?
Title: Re: Karma Blocks Package v0.3
Post by: vulcan on June 21, 2006, 01:09:14 AM
1.0.7
Title: Re: Karma Blocks Package v0.3
Post by: Max on June 22, 2006, 09:08:32 AM
Quote from: vulcan on June 21, 2006, 01:09:14 AM
1.0.7

havent tested this mod on 1.0.7 or lower, i suggest you use 1.1 RC2
Title: Re: Karma Blocks Package v0.3
Post by: Avinash on June 26, 2006, 02:27:30 PM
Hi, I have Karma Blocks Package 0.2 installed on my site, but in my list of Top Karmas I get users with negative Karma showing as the highest. http://mac-central.com to see what I mean. Any ideas how to fix this?
Title: Re: Karma Blocks Package v0.3
Post by: Nokonium on June 26, 2006, 05:59:23 PM
This appears to be an SMF/php5  problem, I've just had a look at SMF support and I cannot find a fix for it yet, hopefully RC3 will have one.
Title: Re: Karma Blocks Package v0.3
Post by: Avinash on June 26, 2006, 09:57:55 PM
Quote from: nokonium on June 26, 2006, 05:59:23 PM
This appears to be an SMF/php5  problem, I've just had a look at SMF support and I cannot find a fix for it yet, hopefully RC3 will have one.
Thanks for the reply. I dont even think my server is running php5. It's 4.something.
Title: Re: Karma Blocks Package v0.3
Post by: Thurnok on June 27, 2006, 06:37:41 PM
-1 on top sounds like a Signed/Unsigned integer problem to me...

My 2ÂÃ,¢
Title: Re: Karma Blocks Package v0.3
Post by: k_4_kelly on July 24, 2006, 03:32:26 PM
cool! works nice! ^_^
thanks ya@!
Title: Re: Karma Blocks Package v0.3
Post by: Wartog on August 06, 2006, 04:01:32 AM
hey how do i change the text wartog ""smites"" wartog
How can I change "smites" to a different word?
Title: Re: Karma Blocks Package v0.3
Post by: borgBOB on August 06, 2006, 04:09:38 AM
In SMF admin , there is a place to change the name of the Karma labels. (SMF 1.1RC2)
Title: Re: Karma Blocks Package v0.3
Post by: Wartog on August 06, 2006, 04:18:34 AM
Yeah I changed those and they show up to what I changed them to in a post, but in the karma block karma log it shows up wartog"smites"coolmike
Title: Re: Karma Blocks Package v0.3
Post by: Wartog on August 06, 2006, 05:09:33 AM
K never mind I found it. Thanks tho.
Title: Re: Karma Blocks Package v0.3
Post by: 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.

Title: Re: Karma Blocks Package v0.3
Post by: Avinash on August 06, 2006, 02:31:56 PM
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.



Yep. Mine does the same thing. I haven't found a fix yet either :(
Title: Re: Karma Blocks Package v0.3
Post by: Max on August 06, 2006, 07:49:48 PM
i will do and update for this soon....

will fix the -1 showing in top karma, and possibly a way to change the text "Smites" & "Applauds"
Title: Re: Karma Blocks Package v0.3
Post by: Avinash on August 06, 2006, 09:23:29 PM
Quote from: Maxâââ,¬Å¾Ã,¢ on August 06, 2006, 07:49:48 PM
i will do and update for this soon....

will fix the -1 showing in top karma, and possibly a way to change the text "Smites" & "Applauds"
Okay, thanks for that bro!
Title: Re: Karma Blocks Package v0.3
Post by: Max on August 14, 2006, 12:45:43 AM

Ive updated this mod a small bit... see my first post for the download link & changes made
Title: Re: Karma Blocks Package v0.3
Post by: phong1 on August 28, 2006, 01:54:07 AM
any packages for 1.1rc3 yet?
so i can upgrade my forum.
current mods are: tinyportal, smfarcade, and karma blocks

thanks,

phong
Title: Re: Karma Blocks Package v0.3
Post by: Max on August 28, 2006, 01:07:02 PM
Quote from: phong1 on August 28, 2006, 01:54:07 AM
any package for 1.1rc3 yet?

Edit:
Karma Blocks Package v0.3 Will Work On SMF 1.1 RC3
Title: Re: Karma Blocks Package v0.3
Post by: slebe on September 21, 2006, 03:58:48 PM
Quote from: Avinash on August 06, 2006, 02:31:56 PM
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.



Yep. Mine does the same thing. I haven't found a fix yet either :(

Me too.. (using KBP v0.3)
Title: Re: Karma Blocks Package v0.3
Post by: Max on September 21, 2006, 07:27:35 PM
Quote from: Avinash on August 06, 2006, 02:31:56 PM
Yep. Mine does the same thing. I haven't found a fix yet either :(

Quote from: slebe on September 21, 2006, 03:58:48 PM
Me too.. (using KBP v0.3)

Think its something to do with PHP5 Or MYSQL versions maybe?

Havent yet found the problem.
Title: Re: Karma Blocks Package v0.3
Post by: metal13 on September 26, 2006, 10:58:44 PM
it does not work on smf1.0.8 tp?? huhu...
this error comes out

''The package you are trying to download or install is either corrupt or not compatible with this version of SMF.''
Title: Re: Karma Blocks Package v0.3
Post by: Max on September 27, 2006, 01:02:42 PM
Quote from: metal13 on September 26, 2006, 10:58:44 PM
it does not work on smf1.0.8

thats correct..

Did'nt do a package for 1.0.8, Only 1.1
Title: Re: Karma Blocks Package v0.3
Post by: akulion on September 27, 2006, 01:18:11 PM
i cant believe people actually enjoy karma ...

oh the smfrep system is horrible!

come on max develop us a vB style Rep system :D
Title: Re: Karma Blocks Package v0.3
Post by: Max on September 29, 2006, 05:04:19 PM

lol... uve to pay for vb never mind that!  :P
Title: Re: Karma Blocks Package v0.3
Post by: antichrist on October 01, 2006, 02:33:36 PM
Hey, I have a problem with karmalog, I tried ssi_karmalog() but it shows just last action, never more then 1 is printed ( tried also ssi_karmalog(20); )

thx for help ;)
Title: Re: Karma Blocks Package v0.3
Post by: rebelrose on October 01, 2006, 10:31:35 PM
Great mod Maxâââ,¬Å¾Ã,¢ , I just added it to my site, thanks so much.
Title: Re: Karma Blocks Package v0.3
Post by: rebelrose on October 01, 2006, 10:57:07 PM
I also added an image to the php block:


echo '<a href="'.$scripturl.'?action=stats"><img src="'.$settings['actual_images_url'].'/your image.gif '.'"  /> </a><br>
<span class="smalltext">';
ssi_topkarma();
echo '</span>';



Title: Re: Karma Blocks Package v0.3
Post by: Max on October 02, 2006, 07:38:23 AM
Quote from: antichrist on October 01, 2006, 02:33:36 PM
Hey, I have a problem with karmalog, I tried ssi_karmalog() but it shows just last action, never more then 1 is printed

Sounds like the mod didnt install?
Title: Re: Karma Blocks Package v0.3
Post by: rebelrose on October 02, 2006, 07:53:54 AM
That is how it is showing on mine as well Maxâââ,¬Å¾Ã,¢ , I did some yesterday and it showed them now it is just showing one I did after midnight. But the other blocks are showing fine.
Title: Re: Karma Blocks Package v0.3
Post by: antichrist on October 02, 2006, 09:12:14 AM
just like me, top & lower are showing fine but not the karma log function
Title: Re: Karma Blocks Package v0.3
Post by: mong0l on October 05, 2006, 01:37:15 PM
is this possible?
Title: Re: Karma Blocks Package v0.3
Post by: Redheadriot on October 09, 2006, 02:29:57 AM
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>';
}
Title: Re: Karma Blocks Package v0.3
Post by: Max on October 09, 2006, 08:53:06 AM
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.
Title: Re: Karma Blocks Package v0.3
Post by: rebelrose on October 09, 2006, 09:00:40 AM
So Maxâââ,¬Å¾Ã,¢ , if I make the above changes the karma log will work like it does on your site?
Title: Re: Karma Blocks Package v0.3
Post by: akulion on October 27, 2006, 05:12:47 PM
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

Title: Re: Karma Blocks Package v0.3
Post by: Avinash on December 24, 2006, 04:37:28 PM
Does this work with SMF 1.1.1?
Title: Re: Karma Blocks Package v0.3
Post by: 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.
Title: Re: Karma Blocks Package v0.3
Post by: Avinash on December 24, 2006, 05:56:00 PM
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...
Title: Re: Karma Blocks Package v0.3
Post by: Max on December 26, 2006, 04:01:12 PM

This has being updated for 1.1.1 in my first post .. Let me know of any errors/problems  ;)
Title: Re: Karma Blocks Package v0.4
Post by: slebe on December 26, 2006, 08:04:07 PM
it works! thx Maxâ„¢
Title: Re: Karma Blocks Package v0.4
Post by: Soph on January 04, 2007, 04:43:15 PM
Hello,

ssi_topkarma of Karma v0.4 count only KarmaGood instead of KarmaGood-KarmaBad :o

is it normal ?  :uglystupid2:

exemple :

v.0.4:
$karma_results = db_query("SELECT realName, karmaGood, ID_MEMBER FROM {$db_prefix}members ORDER BY karmaGood DESC LIMIT $topkarma", __FILE__, __LINE__);

V.0.3 :

$karma_results = db_query("SELECT karmaGood, karmaBad, realName, ID_MEMBER FROM {$db_prefix}members ORDER BY (karmaGood-karmaBad) DESC LIMIT $topkarma", __FILE__, __LINE__);
Title: Re: Karma Blocks Package v0.4
Post by: Max on January 06, 2007, 06:32:31 PM
Quote from: Soph on January 04, 2007, 04:43:15 PM
Hello,

ssi_topkarma of Karma v0.4 count only KarmaGood instead of KarmaGood-KarmaBad :o

is it normal ?  :uglystupid2:

yea theres no need to count the karmaBad in the top karma ;)
Title: Re: Karma Blocks Package v0.4
Post by: Soph on January 06, 2007, 07:07:12 PM
i have modified it to count it  ;)

else it display (in my forum) 63 Karma or i have 63 :) - 16 :tickedoff:
Title: Re: Karma Blocks Package v0.4
Post by: Roar_Fan on January 22, 2007, 11:35:09 PM
I wanted to sort by Total Karma (Good - Bad) but the ORDER BY was returning some strange results. Turns out that on some installs of SQL the unsigned status of karmaGood and karmaBad causes issue. I changed these to blank, and presto.. it worked. If anyone else is having the same problem, try this sql query is phpmyadmin:

SELECT realName, karmaGood, karmaBad, ID_MEMBER, karmaGood - karmaBad as karmaTotal FROM smf_members ORDER BY karmaTotal DESC

if karmaTotal is returning a value of around 10000000000000.. then you've got the same problem i had!

Title: Re: Karma Blocks Package v0.4
Post by: Soph on January 23, 2007, 03:24:39 PM
Because user have "negatif" Karma you have this result

do you have many user with more bad karma than good karma ?

in my forum, i have only 2 users where karmaGood-karmaBad < 0 then i "cheat" : i take in my DB:  20 result but i display only (it's a Top Ten) 10 result where the karmaTotal is > 0  ;)

that i use :
//              Karma Package V0.4
//                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, karmaBad, ID_MEMBER FROM {$db_prefix}members ORDER BY (karmaGood-karmaBad) DESC LIMIT 20", __FILE__, __LINE__);

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

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

foreach($context['htkarma'] as $htkarma)
{

$total = $htkarma['Good']-$htkarma['Bad'];
if (($recompte<=10) && ($total>=0)) {
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>';
$recompte++;
}
}
echo '</td></tr></table>';

}


I know it's not the best code to solve this problem but it work  ;)

PS: Sorry for my English.
Title: Re: Karma Blocks Package v0.4
Post by: Roar_Fan on January 23, 2007, 09:13:33 PM
Soph. KarmaGood - KarmaBad was returning a positive figure of over 1000000, putting them at the top. THe ONLY way i could find to fix it was to change the database schema itself.

and yeah.. i have about a 50/50 ratio of positives to negatives. Its a very opinionated board!
Title: Re: Karma Blocks Package v0.4
Post by: Soph on January 23, 2007, 09:49:23 PM
Quote from: Roar_Fan on January 23, 2007, 09:13:33 PM
Soph. KarmaGood - KarmaBad was returning a positive figure of over 1000000
yeah i have same result that what i use my code.
But if you have many user with karmaBad more than theire karmaGood, my code is'nt good to solve the problem.

QuoteTHe ONLY way i could find to fix it was to change the database schema itself.
i think it's better, add a row karmatotal to smf_members and update it in source code when user add or remove karma.
Title: Re: Karma Blocks Package v0.4
Post by: jacortina on January 23, 2007, 10:08:57 PM
Quote from: Roar_Fan on January 23, 2007, 09:13:33 PM
Soph. KarmaGood - KarmaBad was returning a positive figure of over 1000000, putting them at the top. THe ONLY way i could find to fix it was to change the database schema itself.

and yeah.. i have about a 50/50 ratio of positives to negatives. Its a very opinionated board!


It's presenting it as a large positive because of unsigned integer wraparound.

uint(1) - uint(2) is usually not presented as -1 but as the integer limit in the positive direction (unsigned MEANS no sign, no positive, no negative and results are most often given in the same data type as the arguments).
Title: Re: Karma Blocks Package v0.4
Post by: Stirred on February 08, 2007, 02:02:51 PM
Hey!!

Thanks for this Mod, it kicks ass for anyone who wants to get more with Karma.

Well i give in return my block:
echo '<img src="http://YOUR SITE/Themes/YOUR THEME/images/TPdivider.gif"> <font size="1pt" face="Verdana">Últimos Classificados:</font>';
echo '<hr>';
ssi_karmalog(6);
echo '<br>';
echo '<img src="http://YOUR SITE/Themes/YOUR THEME/images/up.gif"> <font size="1pt" face="Verdana">Membros + <font color="green">Aplaudidos</font>:</font>';
echo '<hr>';
ssi_topkarma(5);
echo '<br>';
echo '<img src="http://YOUR SITE/Themes/YOUR THEME/images/down.gif"> <font size="1pt" face="Verdana">Membros + <font color="red">Avisados</font>:</font>';
echo '<hr>';
ssi_lowestkarma(5);


It's in Portuguese but you can change to whatever you want in order suit to your site.
Title: Re: Karma Blocks Package v0.4
Post by: Bastet on February 22, 2007, 02:55:36 PM
Does anyone know if it is possible to keep a log or to track who's giving who Karma? I think I have users padding their friends' Karma and I'd like to kind of keep an eye on it.
Title: Re: Karma Blocks Package v0.4
Post by: G6Cad on February 22, 2007, 03:00:31 PM
I think the best bet to get an answer is to ask on simplemachines.org and the mod board there.
I havent read or heard of anything like that in here though  :-\
Title: Re: Karma Blocks Package v0.4
Post by: Bastet on February 22, 2007, 03:21:33 PM
Thanks! :)
Title: Re: Karma Blocks Package v0.4
Post by: Lesmond on February 22, 2007, 03:23:09 PM
look here but its not been updated for a while http://custom.simplemachines.org/mods/index.php?mod=127
Title: Re: Karma Blocks Package v0.4
Post by: Bastet on February 22, 2007, 03:25:58 PM
Thank you for you quick responses guys! :)
Title: Re: Karma Blocks Package v0.4
Post by: Bastet on February 22, 2007, 03:27:20 PM
QuoteThe package you are trying to download or install is either corrupt or not compatible with this version of SMF.

Yeah :-\ I don't think it's compatable with the latest versions of SMF. That looks to be exactly what I'm needing too unfortunatley.
Title: Re: Karma Blocks Package v0.4
Post by: G6Cad on February 22, 2007, 04:12:57 PM
Have you checked this one ?
http://custom.simplemachines.org/mods/index.php?mod=192
Title: Re: Karma Blocks Package v0.4
Post by: jacortina on February 22, 2007, 04:15:00 PM
I was just about to point to that one, G6.

I believe that the original Karma Log mod is no longer supported as the developer felt that the Karma Description mod did everything his did and more.

A believe that's updated through 1.1.1 (if at 1.1.2, you might need to tweak the package).
Title: Re: Karma Blocks Package v0.4
Post by: jdvarner on February 23, 2007, 02:55:08 AM
Is it possible to make a block that will show your true karma count?

For example I have 10 positive karma and 9 positive karma. So it shows that im 10 positive karma in the top karma.

But in reality my karma is really only "1" since i got 9 positive?

Does anyone have code.

Jd
Title: Re: Karma Blocks Package v0.4
Post by: Shane84 on March 10, 2007, 10:33:50 AM
Quote from: J.A.Cortina on February 22, 2007, 04:15:00 PM
I was just about to point to that one, G6.

I believe that the original Karma Log mod is no longer supported as the developer felt that the Karma Description mod did everything his did and more.

A believe that's updated through 1.1.1 (if at 1.1.2, you might need to tweak the package).

Except the Karma Description Mod is really picky, all the moons of jupiter have to be in alignment with the stars of the galaxy in order to get it to install.  I just liked the simple little karma log that we could keep on our site, just for admins to see, nothing bulky and huge and invasive.

I hope someone can figure it out for 1.1.2 because I don't know the first thing :P
Title: Re: Karma Blocks Package v0.4
Post by: ambideXtrous on July 26, 2007, 06:51:00 AM
I get this when trying to install on SMF 1.1.3 with TP .9:

The package you are trying to download or install is either corrupt or not compatible with this version of SMF.
Title: Re: Karma Blocks Package v0.4
Post by: saks on November 22, 2011, 08:24:22 AM
sorry, I am found karma code...