News:

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

Main Menu

Karma Description Mod

Started by Grek.Kamchatka, September 11, 2005, 11:48:26 PM

Previous topic - Next topic

SleePy

this is my whole viewkarma.template.php


<?php
// Version: 1.1 RC2; Viewkarma


function template_main()
{
        global 
$context$txt$member$user_info$scripturl$settings$modSettings$ID_MEMBER;
        echo 
'
                <div style="padding: 3px;">'
theme_linktree(), '</div>
                    <form action="'
$scripturl'?action=viewkarma;start='.$context['start'].';sort='.$context['sort_by'].''$context['sort_direction'] == 'down' ';desc' '''''" method="post" onsubmit="if (lastClicked == \'remove_selection\' && !confirm(\''$txt['sure_about_karma_remove'], '\')) return false; else return true;">
                <table border="0" width="100%" cellspacing="1" cellpadding="2" class="tborder" style="margin-bottom: 1ex;">
                        <tr class="titlebg" valign="middle" align="center">
                                <td align="center" colspan="'
$modSettings['karmaurl'] ? '6' '5' ,'"><b>'$txt['karmaview'], '</b> </td>
                                '
; if ($user_info['is_admin']) echo ' <td align="center"></td>'; echo '
                        </tr>
                        <tr class="windowbg">'
;

$WhatPageIsIt $_SERVER["QUERY_STRING"];
if(
strstr($WhatPageIsIt"viewkarma")){ $WhatPage='viewkarma';}else{$WhatPage='ownkarma;u='.$ID_MEMBER.'';}
echo'
                                        <td width="14%" align="center"><b><a href="' 
$scripturl '?action='.$WhatPage.';start='$context['start'], ';sort=exec'$context['sort_direction'] == 'down' && $context['sort_by'] == 'exec' ';asc' '''">'$txt['karmawho'], ''$context['sort_by'] == 'exec' '<img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" border="0" />' '''</a></b></td>
                                        <td width="14%" align="center"><b><a href="' 
$scripturl '?action='.$WhatPage.';start='$context['start'], ';sort=targ'$context['sort_direction'] == 'down' && $context['sort_by'] == 'targ' ';asc' '''">'$txt['karmawhos'],''$context['sort_by'] == 'targ' '<img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" border="0" />' '''</a></b></td>
                                        <td width="10%" align="center"><b><a href="' 
$scripturl '?action='.$WhatPage.';start='$context['start'], ';sort=action'$context['sort_direction'] == 'down' && $context['sort_by'] == 'action' ';asc' '''">'$txt['karmawhat'],''$context['sort_by'] == 'action' '<img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" border="0" />' '''</a></b></td>
                                        <td width="31%" align="center"><b>'
$txt['karmadesc'],'</b></td>
                                        '
; if (!empty($modSettings['karmaurl'])) echo '<td width="6%" align="center"><b>'$txt['karmawhere'],'</b></td>'; echo '
                                        <td width="25%" align="center"><b><a href="' 
$scripturl '?action='.$WhatPage.';start='$context['start'], ';sort=time'$context['sort_direction'] == 'down' && $context['sort_by'] == 'time' ';asc' '''">'$txt['karmatime'],''$context['sort_by'] == 'time' '<img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" border="0" />' '''</a></b></td>
                                            '
; if ($user_info['is_admin']) echo ' <td align="center"><b>Delete</b></td>'; echo '
                        </tr>'
;

        
//Âûâîäèì ïîëó÷åííûå äàííûå â òàáëè÷íîé ôîðìå.
        
foreach ($context['karma_changes'] as $member)

if (!empty(
$modSettings['karmalogview']) && ($user_info['is_admin']))

        echo 
'                
                                <script language="JavaScript1.2" type="text/javascript"><!--
                                var lastClicked = "";
                                // --></script>
                        <tr class="windowbg">
                                <td width="14%" align="center"><a href="'
$scripturl '?action=profile;u=' $member['id_exec'] . '" title="' $txt[92] . ' ' $member['executor'] . '">' $member['executor'] . '</a>'
                                if (!empty(
$modSettings['karmakarma'])) 
                                                echo
' <span class="smalltext">(+',$member['executorkarmagood'],'/-',$member['executorkarmabad'],')</span>'
        echo 
'</td>
                                <td width="14%" align="center"><a href="'
$scripturl '?action=profile;u=' $member['id_targ'] . '" title="' $txt[92] . ' ' $member['target'] . '">' $member['target'] . '</a>'
                                if (!empty(
$modSettings['karmakarma'])) 
                                                echo
' <span class="smalltext">(+',$member['targetkarmagood'],'/-',$member['targetkarmabad'],')</span>'
        echo 
'</td>
                                <td width="10%" align="center">'
$member['action'], '</td>
                                <td width="31%" align="center">'
$member['Description'], '</td>';
                                if (!empty(
$modSettings['karmaurl']))
                                                echo 
'<td width="6%" align="center">',$member['link']!='PM' '<a href="'$scripturl '?topic='$member['link'].'" target="_blank">'.$txt['karmawhereurl'].'</a>' $txt['karmawhereurl2'],'</td>';
        echo 
'                  <td width="25%" align="center">'$member['time'], '</td>
                                        <td align="center"><input type="checkbox" name="delete[]" value="'
$member['logtime'], '" class="check" /></td>
                        </tr>'
;
}
elseif (!empty(
$modSettings['karmalogview']))

        echo 
'
                        <tr class="windowbg">
                                <td width="14%" align="center"><a href="'
$scripturl '?action=profile;u=' $member['id_exec'] . '" title="' $txt[92] . ' ' $member['executor'] . '">' $member['executor'] . '</a>'
                                if (!empty(
$modSettings['karmakarma'])) 
                                                echo
' <span class="smalltext">(+',$member['executorkarmagood'],'/-',$member['executorkarmabad'],')</span>'
        echo 
'</td>
                                <td width="14%" align="center"><a href="'
$scripturl '?action=profile;u=' $member['id_targ'] . '" title="' $txt[92] . ' ' $member['target'] . '">' $member['target'] . '</a>'
                                if (!empty(
$modSettings['karmakarma'])) 
                                                echo
' <span class="smalltext">(+',$member['targetkarmagood'],'/-',$member['targetkarmabad'],')</span>'
        echo 
'</td>
                                <td width="10%" align="center">'
$member['action'], '</td>
                                <td width="31%" align="center">'
$member['Description'], '</td>';
                                if (!empty(
$modSettings['karmaurl']))
                                                echo 
'<td width="6%" align="center"><a href="'$scripturl '?topic='$member['link'],'" target="_blank">'.$txt['karmawhereurl'].'</a></td>';
        echo 
'                  <td width="25%" align="center">'$member['time'], '</td>
                        </tr>'
;
}
else
{
        echo 
'
                        <tr class="windowbg">
                                <td width="14%" align="center" >' 
$member['executor'] , ''
                                if (!empty(
$modSettings['karmakarma'])) 
                                                echo
' <span class="smalltext">(+',$member['executorkarmagood'],'/-',$member['executorkarmabad'],')</span>'
        echo 
'</td>
                                <td width="14%" align="center">' 
$member['target'] , '';
                                if (!empty(
$modSettings['karmakarma']))
                                                echo
' <span class="smalltext">(+',$member['targetkarmagood'],'/-',$member['targetkarmabad'],')</span>';
        echo 
'</td>
                                <td width="10%" align="center">'
$member['action'], '</td>
                                <td width="31%" align="center">'
$member['Description'], '</td>
                                <td width="6%" align="center"><a href="'
$scripturl '?topic='$member['link'],'" target="_blank">'.$txt['karmawhereurl'].'</a></td>
                                <td width="25%" align="center">'
$member['time'], '</td>
                        </tr>'
;
}          
        
//Ñòðîêà ñ îáùèì ÷èñëîì ðåçóëüòàòîâ è ññûëêàìè íà ñòðàíè÷êè ñ ðåçóëüòàòàìè
        
echo'
                        <tr class="titlebg" valign="middle" align="center">
                             <td align="center" colspan="'
$modSettings['karmaurl'] ? '6' '5' ,'">(',$txt['karmanumb'].$context['totalActions'],')</td>';
                        if (
$user_info['is_admin']) echo ' <td align="center"><label for="check_all1"><input type="checkbox" id="check_all1" onclick="invertAll(this, this.form, \'delete[]\'); this.form.check_all2.checked = this.checked;" class="check" /> </label></td>'; echo '
                        </tr>
                        <tr class="titlebg">
                             <td colspan="'
$modSettings['karmaurl'] ? '6' '5' ,'"><b>'$txt[139], ':</b> '$context['page_index'] , '</td>';
                        if (
$user_info['is_admin']) echo ' <td align="center"><div style="float: right;"><input type="submit" name="delete_selection" value="'$txt['karma_delete'], '" onclick="lastClicked = \'remove_selection\';" /> </div></td></form>'; echo '
                        </tr>
                        </table>'
;

        
//Ïðî÷àÿ ñòàòèñòèêà
        
if (!empty($modSettings['karmaotherstat']))
        {
        echo 
'<table border="0" width="100%" cellspacing="1" cellpadding="2" class="tborder">                         
                     <tr class="titlebg" valign="middle" align="center">
                         <td align="center" colspan="3"><b>'
$txt['karma_stat'], '</b>
                         </td>
                     </tr>
                     <tr class="windowbg">
                         <td width="38%" align="center"><b>'
,$txt['karma_other_stat'],'</b></td>
                         <td width="31%" align="center"><b>'
,$txt['karma_top_applaud'],'</b></td>
                         <td width="31%" align="center"><b>'
,$txt['karma_top_smite'],'</b></td>                         
                     </tr>
                     
                     <tr class="windowbg">
                         <td width="38%">
              <table border="0" cellpadding="1" cellspacing="0">                     
                     <tr><td width="28%">'
,$txt['karma_max_appl'],'</td>
                     <td width="10%" align="right">'
,$context['memidappl'],' + [',$context['memidapplcount'],']</td></tr>
                     <tr><td width="28%">'
,$txt['karma_max_smit'],'</td>
                     <td width="10%" align="right">'
,$context['memidsmit'],' - [',$context['memidsmitcount'],']</td></tr>
                     <tr><td width="28%">'
,$txt['karma_today'],'</td><td width="10%" align="right">',$context['today_point'] ,'</td></tr>
                     <tr><td width="28%">'
,$txt['karma_today_plus'],'</td><td width="10%" align="right">',$context['today_plus'] ,'</td></tr>
                     <tr><td width="28%">'
,$txt['karma_today_minus'],'</td><td width="10%" align="right">',$context['today_minus'] ,'</td></tr>
              </table></td>
                         <td width="31%">
              <table border="0" cellpadding="1" cellspacing="0">'
;
       foreach (
$context['top_applaud'] as $applauder)
                echo 
'   <tr class="windowbg">
                             <td width="13%" valign="top">'
$applauder['link'], '</td>                                                        
                             <td width="13%" align="left" valign="top">'
$applauder['num_karma'] > '<img src="' $settings['images_url'] . '/bar.gif" width="' $applauder['karma_percent'] . '" height="15" alt="" border="0" />' '&nbsp;''</td>
                             <td width="5%" align="center" valign="top">+ '
$applauder['num_karma'], '</td>                     
                         </tr>'
;
        echo 
'</table></td>        
                      <td width="31%">
              <table border="0" cellpadding="1" cellspacing="0">'
;
       foreach (
$context['top_smite'] as $smiter)
                echo 
'   <tr class="windowbg">
                             <td width="13%" valign="top">'
$smiter['link'], '</td>                                                        
                             <td width="13%" align="left" valign="top">'
$smiter['num_karma'] > '<img src="' $settings['images_url'] . '/bar.gif" width="' $smiter['karma_percent'] . '" height="15" alt="" border="0" />' '&nbsp;''</td>
                             <td width="5%" align="center" valign="top">- '
$smiter['num_karma'], '</td>                     
                         </tr>'
;
        echo 
'</table></td></table>';                         
        }

            
}
?>
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Grek.Kamchatka

OK, i understand. I forget to denote global variable $ID_MEMBER.

So, how about otherkarma?

SleePy

#202
theres other??? ... oh there is... um... hmmm... i have to think a bit on that... i got to remember how to grab the id number out of the url...

--Edit--


$WhatPageIsIt = $_SERVER["QUERY_STRING"];
$UserViewing = $_REQUEST["u"];
if(strstr($WhatPageIsIt, "viewkarma")){ $WhatPage='viewkarma';}
elseif(strstr($WhatPageIsIt, "otherkarma")){ $WhatPage='otherkarma;u='.$UserViewing;}
else{$WhatPage='ownkarma;u='.$ID_MEMBER.'';}
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Grek.Kamchatka

It's doesn't work.
If you'll see ownkarma, u=your own ID. And if you'll see action=viewkarma, you'll see an error in error log, because "u" variable is absent in url. (www.example.com/index.php?action=viewkarma)

Grek.Kamchatka

#204
OK.
This work

$WhatPageIsIt = $_SERVER["QUERY_STRING"];
$UserViewing = $_REQUEST["u"];
if(strstr($WhatPageIsIt, "viewkarma")){ $WhatPage='viewkarma';}
elseif(strstr($WhatPageIsIt, "otherkarma")){ $WhatPage='otherkarma;u='.$UserViewing;}
else{$WhatPage='ownkarma;u='.$UserViewing.'';}


So. Still one bug is present. "u" variable in url like index.php?action=viewkarma

Edit
SleePy. For you. It's work without any bugs.

$WhatPageIsIt = $_SERVER["QUERY_STRING"];
if (isset($_REQUEST['u'])) $UserViewing = $_REQUEST['u'];
if(strstr($WhatPageIsIt, "viewkarma")){ $WhatPage='viewkarma';}
elseif(strstr($WhatPageIsIt, "otherkarma")){ $WhatPage='otherkarma;u='.$UserViewing;}
else{$WhatPage='ownkarma;u='.$UserViewing.'';}


For other. In KDM ver. 1.9.4 All this bugs is fixed.


Chronic667

The page for this mod isn't showing the download url for the lastest version.

Grek.Kamchatka

I know, i know. Moderator will clean old packages id and there will be new version.

SleePy

oh.. i didn't think about that when they weren't on the page...
btw.. i saw the download for 1.9.4.. i was the first to download it.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Grek.Kamchatka


phoneix

can someone write which files and folders, should i make 777 to install this mod...

i use 1.1 rc2

Grek.Kamchatka

Phoneix, http://_your_smf_forum_/index.php?action=packages;sa=options

Check "All files are writable." and save all changes. After installing the mod you can back to " Only the standard files are writable."

P.S.
Manualy, if you need.
smf\index.php
smf\Source\Admin.php
smf\Source\BoardIndex.php
smf\Source\Karma.php
smf\Source\ManagePermissions.php
smf\Source\ModSettings.php
smf\Source\Profile.php
smf\Themes\default\Admin.template.php
smf\Themes\default\BoardIndex.template.php
smf\Themes\default\Profile.template.php
smf\Themes\default\languages\Admin.english.php
smf\Themes\default\languages\Errors.english.php
smf\Themes\default\languages\Help.english.php
smf\Themes\default\languages\index.english.php
smf\Themes\default\languages\ManagePermissions.english.php
smf\Themes\default\languages\ModSettings.english.php
smf\Themes\default\languages\Profile.english.php
smf\Themes\default\languages\Who.english.php

smf\Sources and smf\Themes\default must be writable.

perplexed

Hi

This is a great mod and I installed it with no probs whatsoever.

There is only one thing that I cant find  ???


the picture you have in the mod page that shows karma stats 'most applauded' 'most smited' etc 

I cant find that option

All I have in 'karma stats' is karma change description

Where can I find the info that shows who gets the most karma etc?

Thanks

Chronic667

I'm guessing you mean the "Top 5 applauded users" and "Top 5 smited users".

This shows on your karma stats page, to find that scroll to the bottom of your index page and next to [More Stats], you should see [Karama Stat]. That page is where you'll find them.

perplexed

yeah thats what I thought too but its on showing when I click that link,

Heres what I see:

                                                 The survey of a change in the reputation of users 
Who                Whom        What (+/-)           For What                           When
name1            snap                +                      Luff ya!                           Today at 07:34:46 PM
nab1               heart               +                    for my cool banner!           Today at 07:30:29 PM
Ana                 Beth               +                    Thanks                                Today at 07:29:30 PM

and so on for 4 pages...

Which is pretty cool in itself but nowhere can I find the  "Top 5 applauded users" and "Top 5 smited users".

I can reorder that list to sort by who, when etc but that doesnt give me what is pictured on the mod description page :(

Grek.Kamchatka

Do you enabled "Show other Karma Statistics"? in http://www.your_forum.com/index.php?action=featuresettings;sa=karma

perplexed

#215
in features and options, under karma, I have:

Karma 

Karma mode  Disable karma Enable karma total Enable karma positive/negative 
Enable Karma Description Mod   SWITCHED ON
Members per page in Karma Description log   10 MEMBER DEFAULT
Use member names as link to the profile   SWITCHED ON
Allow users view Karma Description log (See Permissions)   NOT SWITCHED ON
Enable karma links in users profiles   SWITCHED ON

I cant find that other option you mention ' show other karma stats' :(

If I follow that link ...myforum... ?action=featuresettings;sa=karma it takes me to the main index page of the forum. The karma stats link is next to the forum stats link but as I said above there is no 'top 5' listed


Grek.Kamchatka

Hm...What version of KDM you use???
Final relise is KDM 1.9.4


perplexed

ok I just realised there is another problem

the users cant view who gave them karma and who they gave it to, in their profiles.  It comes up with an error saying

' An Error Has Occurred!
Sorry - you don't have the proper permissions to view the Karma Description list. '

How do I fix this?

The only option I have in features and options is

Allow users view Karma Description log (See Permissions)   NOT SWITCHED ON

which will allow users to see all the karma for everyone right?

and
In permissions:
General A X D
  View forum statistics   
  View the memberlist   
  View Who's Online   
  View Karma Log   
  Search for posts and topics   
  Change other people's karma   

I just want them to be able to see their own :(




Grek.Kamchatka

Quote from: perplexed on February 09, 2006, 08:28:25 AM
which will allow users to see all the karma for everyone right?
Yes, you are right.

Quote
I just want them to be able to see their own
You can edit source code of my mod. I can't write this function at that time.

Advertisement: