Topic: Karma (pun_karma)

Here is description of the extension.
Download links:

Or you can download pun_karma with help of pun_repository extension.
Feel free to report any bugs.

2 (edited by TwincamSam 2009-09-07 14:43)

Re: Karma (pun_karma)

Great...we were awaiting this release for quite a while.

Works perfectly.

Can i replace the + and - Karma buttons with images?

Re: Karma (pun_karma)

thanks

Re: Karma (pun_karma)

I've had this in use for many many months. is this a new version or something?

Re: Karma (pun_karma)

TwincamSam wrote:

Great...we were awaiting this release for quite a while.

Works perfectly.

Can i replace the + and - Karma buttons with images?

It is planned in the next pun_karma release.

esupergood wrote:

I've had this in use for many many months. is this a new version or something?

It is the first official release of extension. I suppose you use the extension "user_karma". It was the base for pun_karma. The major changes from user_karma:

  • Table "user_karma" was renamed to "pun_karma"

  • Added a new field "karma" to table "posts"

  • Added SEF-support

  • Added posibility to disable the down mark to posts

  • Added posibility to set the number of minutes users have to wait before voting for a post (two options for down and up mark)

  • Added protection from CSRF attacks.

If you want to migrate to pun_karma extension, do the following:

  • Make a backup of table "<DB_PREFIX>user_karma"

  • Disable the extension "user_karma"

  • Rename the "user_karma" table to "pun_karma"

  • Run this script:

<?php

if (!defined('FORUM_ROOT'))
    define('FORUM_ROOT', './');
require FORUM_ROOT.'include/common.php';

$forum_db->add_field('posts', 'karma', 'INT(10)', TRUE);

$pun_karma_query = array(
    'SELECT'    =>    'post_id, SUM(mark) AS sum_mark',
    'FROM'        =>    'pun_karma',
    'GROUP BY'    =>    'post_id'
);
$pun_karma_res = $forum_db->query_build($pun_karma_query) or error(__FILE__, __LINE__);

while ($cur_karma = $forum_db->fetch_assoc($pun_karma_res))
{
    $pun_karma_query = array(
        'UPDATE'    =>    'posts',
        'SET'        =>    'karma = '.$cur_karma['sum_mark'],
        'WHERE'        =>    'id = '.$cur_karma['post_id']
    );
    $forum_db->query_build($pun_karma_query) or error(__FILE__, __LINE__);
}

echo 'Done.';

?>

Re: Karma (pun_karma)

The new version of pun_karma 1.1 has been released.
Changes from previous version:

  • Added icons instead of +, -, X characters

  • Added calculating of users karma.

Re: Karma (pun_karma)

Has anyone here migrated from old karma to new karma? Was it easy?
How do you "run" the above script?

Re: Karma (pun_karma)

Here the script for migration from user_karma to pun_karma 1.1. Other instructions are the same.

<?php

if (!defined('FORUM_ROOT'))
    define('FORUM_ROOT', './');
require FORUM_ROOT.'include/common.php';

@set_time_limit(0);

$forum_db->add_field('posts', 'karma', 'INT(10)', TRUE);

$pun_karma_query = array(
    'SELECT'    =>    'post_id, SUM(mark) AS sum_mark',
    'FROM'        =>    'pun_karma',
    'GROUP BY'    =>    'post_id'
);
$pun_karma_res = $forum_db->query_build($pun_karma_query) or error(__FILE__, __LINE__);

while ($cur_karma = $forum_db->fetch_assoc($pun_karma_res))
{
    $pun_karma_query = array(
        'UPDATE'    =>    'posts',
        'SET'        =>    'karma = '.$cur_karma['sum_mark'],
        'WHERE'        =>    'id = '.$cur_karma['post_id']
    );
    $forum_db->query_build($pun_karma_query) or error(__FILE__, __LINE__);
}

$forum_db->add_field('users', 'karma', 'INT(10)', TRUE);
$pun_karma_query = array(
    'SELECT'    =>    'poster_id, SUM(mark) AS user_karma',
    'FROM'        =>    $forum_db->prefix.'posts AS p, '.$forum_db->prefix.'pun_karma AS pk',
    'WHERE'        =>    'p.id = pk.post_id',
    'GROUP BY'    =>    'poster_id',
    'PARAMS'    =>    array(
        'NO_PREFIX'    =>    true
    )
);
$pun_karma_res = $forum_db->query_build($pun_karma_query) or error(__FILE__, __LINE__);

if ($forum_db->num_rows($pun_karma_res) > 0)
{
    while ($cur_karma = $forum_db->fetch_assoc($pun_karma_res))
    {
    $pun_karma_update_query = array(
        'UPDATE'    =>    'users',
        'SET'        =>    'karma = '.$cur_karma['user_karma'],
        'WHERE'        =>    'id = '.$cur_karma['poster_id']
       );
       $forum_db->query_build($pun_karma_update_query) or error(__FILE__, __LINE__);
    }
}

echo 'Done.';
?>
esupergood wrote:

How do you "run" the above script?

  • Copy/paste this script to the file "<FORUM_ROOT>/migration_user_karma_to_pun_karma.php"

  • Request the page "<FORUM_URL>/migration_user_karma_to_pun_karma.php"

  • Remove the file "<FORUM_ROOT>/migration_user_karma_to_pun_karma.php".

Re: Karma (pun_karma)

Excellent work Slavok. This is a fantastic addon!

Some users have requested a feature possibly in thier profile where they can view which of their posts were rated and who rated them.

Could you possibly add this on in a new version update? This would make an already great extension even better.   wink

10

Re: Karma (pun_karma)

Add your request to the extension's Wiki page, please.

Re: Karma (pun_karma)

Done. Thanks

12

Re: Karma (pun_karma)

Any idea why I'd get this error in Version v1.1.1.

Notice: Undefined index: post_karma in /home/.../viewtopic.php(325) : eval()'d code on line 10
Notice: Undefined index: user_karma in /home/.../viewtopic.php(486) : eval()'d code on line 10

other extensions installed
PunBB Repository   Version v1.2.3.
guest_read_permissions Version v1.0.
Changes Copyright Footer Version v1.0.

13

Re: Karma (pun_karma)

Update to 1.1.2
Fix error described on http://punbb.informer.com/forums/topic/ … deratephp/

Re: Karma (pun_karma)

lang/Lithuanian

<?php

/**
 * Lithuanian language file for pun_karma extension.
 * 
 * If any new strings are added please email them to me and I'll happily
 * translate them.
 * 
 * @author Artūras 'arturaz' Šlajus <x11@arturaz.net>
 * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
 * @package pun_karma
 */

if (!defined('FORUM')) die();

$lang_pun_karma = array(
    'User Karma'        =>     'Vartotojo karma:',
    'Minus mark cancel'    =>    'Karmos mažinimą uždraudė forumo administracija.',
    'Vote error'        =>    'Tu negali balsuoti už savo žinutę',
    'Already voted'        =>    'Tu jau balsavai už šią žinutę.',
    'Cancel error'        =>    'Negali atšaukti savo karmos paskyrimo žinutei, už kurią nebalsavai.',
    'Karma features'    =>    'Pun karma savybės',
    'Karma legend'        =>    'Pun karma parinktys',
    'Disable minus'        =>    'Uždrausti mažinti karmą',
    'Disable minus info'=>    'Pažymėk, jeigu nori neleisti vartotojams mažinti kitų žmonių karmos.',
    'Plus interval'        =>    'Karmos didinimo intervalas',
    'Plus interval info'=>    'Laiko tarpas minutėmis, kuris turi praeiti tarp dviejų karmos padidinimų.',
    'Minus interval'    =>    'Karmos mažinimo intervalas',
    'Minus interval info'=>    'Laiko tarpas minutėmis, kuris turi praeiti tarp dviejų karmos sumažinimų.',
    'Plus interval rest' =>    'Turi praeiti bent %s minučių tarp karmos padidinimų.',
    'Minus interval rest'=>    'Turi praeiti bent %s minučių tarp karmos sumžainimų.',
    'Alt cancel'        =>    'Atšaukti',
    'Alt thumbs up'        =>    'Padidinti',
    'Alt thumbs down'    =>    'Sumažinti'
);

?>

Re: Karma (pun_karma)

Excellent extension..

Is there any way one can remove just the - (negative) part of it?
Reason: just want members to have the option to thumbs up a post, not down!

16

Re: Karma (pun_karma)

I would like to add so everyone can see who's "rated" the post. Can anybody help me?
I can't even find where i edit the "post_options"

Thx in advance!

Re: Karma (pun_karma)

Any updates for punbb 1.4.2?

Re: Karma (pun_karma)

I have found a problem where the thumbup and thumbdown only show up in a post. I dont see it in other posts. Any idea why?

19

Re: Karma (pun_karma)

Hi Slavok

I was wondering what license this was released under (if any)?

Cheers

20

Re: Karma (pun_karma)

Propably GNU GPL, like PunBB.

21

Re: Karma (pun_karma)

Ah yes, just found in the source..

/**
 * Adds karma/reputation to posts.
 *
 * @copyright (C) 2008-2009 PunBB
 * @license [url]http://www.gnu.org/licenses/gpl.html[/url] GPL version 2 or higher
 * @package pun_karma
 */

22

Re: Karma (pun_karma)

Will be this extension officialy updated to 1.4 and moved to extensions section?

Re: Karma (pun_karma)

Is there way to make it work on 1.4.2 ?

24

Re: Karma (pun_karma)

http://punbb.informer.com/forums/post/142649/#p142649