» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Online Users: 215
0 members and 215 guests
No Members online
Most users ever online was 611, 03-21-2008 at 10:10 PM.
» .::.
Web Hosting - web hosting, dedicated servers and web design services.
Online Degree - search for 1000+ online degrees, online colleges & online universities.
Evden eve nakliyat - Evden eve Nakliyat
tattoo - We are a group of tattoo enthusiasts
Gexa Energy - Your absolute best choice in electric service
Texas electricity - save on electric rates

Register Now! Contact Us

About this Page
This is a discussion on problem with karma mod in nuke within the Nuke 7.x - Modules forums, part of the PHP-Nuke 7.x category; hi all, i installed the karma mod in my nuke after some modification i made to fit it to nuke ...



Go Back   Nukemods Forum » PHP-Nuke 7.x » Nuke 7.x - Modules

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-04-2007, 03:41 AM
Junior Member
 
Join Date: Mar 2007
Posts: 3
problem with karma mod in nuke
hi all,
i installed the karma mod in my nuke
after some modification i made to fit it to nuke
its work just fine
but i have a littel problem that the page after i vote didnt go back to the topic before the voting

here is the code of the mode:
Code:
############################################################## 
## MOD Title: Advanced Karma Mod 
## MOD Author: Nome <nome> 
## MOD Original Author: countach44 <root> 
## MOD Description: This will add the ability to give users karma points 
##         Stacks karma points in two different groups 
##         so that users both have + and - shown 
##         Has an hour based wait option (UNIX time based, no Windows here) 
## MOD Version: 1.0.1 
## 
## Installation Level: easy 
## Installation Time: 10 Minutes 
## Files To Edit: 6 
##   viewtopic.php 
##   includes/usercp_viewprofile.php 
##   templates/subSilver/template.cfg 
##   templates/subSilver/profile_view_body.tpl 
##   templates/subSilver/viewtopic_body.tpl 
##   language/lang_english/lang_main.php 
## Included Files: karma.php, icon_applaud.gif, icon_smite.gif, 
##         mysql_schema.sql (for not installed forums only!) 
############################################################## 
## Author Notes: Thanks to countach44 for starting the mode 
##       I've made a few changes to his file, so that the 
##      MOD looks more attractive. At least to me ;) 
## 
############################################################## 
## This MOD is released under the GPL License. 
## Intellectual Property is retained by the MOD Author(s) listed above 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 

# 
#-----[ ALTER ]------------------------------------------ 
# 
ALTER TABLE `phpbb_users` ADD `karma_plus` MEDIUMINT DEFAULT '0' NOT NULL ; 
ALTER TABLE `phpbb_users` ADD `karma_minus` MEDIUMINT DEFAULT '0' NOT NULL ; 
ALTER TABLE `phpbb_users` ADD `karma_time` BIGINT DEFAULT '0' NOT NULL ; 

# 
# NOTE: 'phpbb_' is our $table_prefix 
# 

# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/usercp_viewprofile.php 

# 
#-----[ FIND ]------------------------------------------ 
# 
// 
// Calculate the number of days this user has been a member ($memberdays) 
// Then calculate their posts per day 
// 

# 
#-----[ BEFORE, ADD ]------------------------------------ 
# 
//Fetch karma 
$sql = "select karma_plus from " . USERS_TABLE . " where username='$profiledata[username]'"; 
$result = $db->sql_query($sql); 
$array = mysql_fetch_array($result); 
$karma_plus = $array[0]; 
$sql = "select karma_minus from " . USERS_TABLE . " where username='$profiledata[username]'"; 
$result = $db->sql_query($sql); 
$array = mysql_fetch_array($result); 
$karma_minus = $array[0]; 

# 
#-----[ FIND ]------------------------------------------ 
# 
   'JOINED' => create_date($lang['DATE_FORMAT'], $profiledata['user_regdate'], $board_config['board_timezone']), 

# 
#-----[ AFTER, ADD ]------------------------------------ 
# 
   'KARMA_PLUS' => $karma_plus, 
   'KARMA_MINUS' => $karma_minus, 

# 
#-----[ FIND ]------------------------------------------ 
# 
   'L_EMAIL' => $lang['Email'], 

# 
#-----[ AFTER, ADD ]------------------------------------ 
# 
   'L_KARMA' => $lang['Karma'], 

# 
#-----[ OPEN ]------------------------------------------ 
# 
viewtopic.php 

# 
#-----[ FIND ]------------------------------------------ 
# 
   'L_AUTHOR' => $lang['Author'], 

# 
#-----[ AFTER, ADD ]------------------------------------ 
# 
   'L_KARMA' => $lang['Karma'], 

# 
#-----[ FIND ]------------------------------------------ 
# 
   // 
   // Again this will be handled by the templating 
   // code at some point 

# 
#-----[ BEFORE, ADD ]------------------------------------ 
# It's the only way I could get it working, not very neat though :( 
   //Fetch karma 
   $sql = "select karma_plus from " . USERS_TABLE . " where username='$poster'"; 
   $result = $db->sql_query($sql); 
   $array = mysql_fetch_array($result); 
   $karma_plus = $array[0]; 
   $sql = "select karma_minus from " . USERS_TABLE . " where username='$poster'"; 
   $result = $db->sql_query($sql); 
   $array = mysql_fetch_array($result); 
   $karma_minus = $array[0]; 
   $applaud_img = ''; 
   $applaud_alt = ''; 
   $applaud_url = ''; 
   $smite_img = ''; 
   $smite_alt = ''; 
   $smite_url = ''; 

   if ( ( $userdata['session_logged_in'] ) && ( $userdata['user_id'] != $poster_id ) ) 
   { 
      $applaud_alt = $lang['Applaud']; 
      $applaud_url = append_sid("karma.$phpEx?" . POST_TOPIC_URL . '=' . $topic_id . '&' . POST_USERS_URL . '=' . $poster_id . '&x=applaud'); 
      $applaud_img = '<img>'; 

      $smite_alt = $lang['Smite']; 
      $smite_url = append_sid("karma.$phpEx?" . POST_TOPIC_URL . '=' . $topic_id . '&' . POST_USERS_URL . '=' . $poster_id . '&x=smite'); 
      $smite_img = '<img>'; 
   } 


# 
#-----[ FIND ]------------------------------------------ 
# 
      'POSTER_NAME' => $poster, 

# 
#-----[ AFTER, ADD ]------------------------------------ 
# 
      'POSTER_ID' => $poster_id, 

# 
#-----[ FIND ]------------------------------------------ 
# 
      'POSTER_JOINED' => $poster_joined, 

# 
#-----[ AFTER, ADD ]------------------------------------ 
# 
      'POSTER_KARMA_PLUS' => $karma_plus, 
      'POSTER_KARMA_MINUS' => $karma_minus, 

# 
#-----[ FIND ]------------------------------------------ 
# 
      'MINI_POST_IMG' => $mini_post_img, 

# 
#-----[ AFTER, ADD ]------------------------------------ 
# 
      'APPLAUD_IMG' => $applaud_img, 
      'SMITE_IMG' => $smite_img, 

# 
#-----[ FIND ]------------------------------------------ 
# 
      'L_MINI_POST_ALT' => $mini_post_alt, 

# 
#-----[ AFTER, ADD ]------------------------------------ 
# 
      'L_APPLAUD_ALT' => $applaud_alt, 
      'L_SMITE_ALT' => $smite_alt, 

# 
#-----[ FIND ]------------------------------------------ 
# 
      'U_MINI_POST' => $mini_post_url, 

# 
#-----[ AFTER, ADD ]------------------------------------ 
# 
      'U_APPLAUD' => $applaud_url, 
      'U_SMITE' => $smite_url, 

#********************************************************************* 
#                                
# NOTE: You will have to apply these changes to all existing templates 
# I use SubSilver as an example                       
#                                
#********************************************************************* 

# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/subSilver.cfg 

# 
#-----[ FIND ]------------------------------------------ 
# 
$images['icon_minipost'] = "$current_template_images/icon_minipost.gif"; 

# 
#-----[ AFTER, ADD ]------------------------------------ 
# 
$images['icon_applaud'] = "$current_template_images/icon_applaud.gif"; 
$images['icon_smite'] = "$current_template_images/icon_smite.gif"; 

# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/profile_view_body.tpl 

# 
#-----[ FIND ]------------------------------------------ 
# 
      <tr> 
        <td><span>{L_EMAIL_ADDRESS}:</span></td> 
        <td><span>{EMAIL_IMG}</span></td> 
      </tr> 

# 
#-----[ AFTER, ADD ]------------------------------------ 
# 
      <tr> 
        <td><span>{L_KARMA}:</span></td> 
                  <td><span>+{KARMA_PLUS}/-{KARMA_MINUS}</span></td> 
      </tr> 

# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/viewtopic_body.tpl 

# 
#-----[ FIND ]------------------------------------------ 
# 
{postrow.POSTER_POSTS}
 

# 
#-----[ IN-LINE AFTER, ADD ]--------------------------------------- 
# 
<font>{L_KARMA}: +{postrow.POSTER_KARMA_PLUS}/-{postrow.POSTER_KARMA_MINUS} <a>{postrow.APPLAUD_IMG}</a><a>{postrow.SMITE_IMG}</a></font>
 

#************************************************************************** 
#                                
# NOTE: You will have to apply these changes to all existing language packs 
# I use lang_english as an example                       
#                                
#************************************************************************** 

# 
#-----[ OPEN ]------------------------------------------ 
# 
language/lang_english/lang_main.php 

# 
#-----[ FIND ]------------------------------------------ 
# 
// 
// That's all Folks! 
// ------------------------------------------------- 

# 
#-----[ BEFORE, ADD ]------------------------------------ 
# 
$lang['Karma'] = 'Karma'; 
$lang['Applaud'] = 'Applaud'; 
$lang['Smite'] = 'Smelt'; 
$lang['Return_To_Topic'] = 'Return to topic'; 
$lang['Too_Soon'] = 'You can't change karma yet. Not enough time has passed'; 
$lang['No_Self_Karma'] = 'You can't change your karma'; 

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
and here is the karma.php code:

Code:
<php>sql_query($sql);
	$array = mysql_fetch_array($result);
	$time_old = $array[0];
	$sql = "select user_id from " . USERS_TABLE . " where user_id='$userdata[user_id]'";//make sure no one votes for themselves
	$result = $db->sql_query($sql);
	$array = mysql_fetch_array($result);
	$voter_id = $array[0];
if($voter_id == $user)
{
	message_die(CRITICAL_MESSAGE, $lang['No_Self_Karma'] . '
<a> ' . $lang['Return_To_Topic'] . ' </a>');
}
else
{

	$time = time();
	$diff = $time - $time_old;
	if($diff >= 3600 * $hours_past || $userdata['user_level'] > 0) //make sure they haven't voted in the last hour or if they're a mod or admin, they can continue
		{
			if ($x == 'applaud')
			{
				$sql = "select karma_plus from " . USERS_TABLE . " where user_id='$user'"; //Find the good guy
				$result = $db->sql_query($sql); 
				$array = mysql_fetch_array($result);
 				$karma = $array[0];
				// We only up karma by one
				$karma = $karma + 1;
				// Here comes the db update 
				$karma_update = "update " . USERS_TABLE . " set karma_plus ='$karma' where user_id='$user'";	
			}
			else
			// If someone tries to fake the x input, that someone will get bad karma ;)
			{
				$sql = "select karma_minus from " . USERS_TABLE . " where user_id='$user'"; //Find the bad guy
				$result = $db->sql_query($sql); 
				$array = mysql_fetch_array($result);
 				$karma = $array[0];
				// We only up karma by one
				$karma = $karma + 1;
				// Here comes the db update 
				$karma_update = "update " . USERS_TABLE . " set karma_minus ='$karma' where user_id='$user'";
			}

	
			//update the database with current time() for voter
			$time_update = "update " . USERS_TABLE . " set karma_time ='$time' where user_id ='$userdata[user_id]'";
			$result = $db->sql_query($karma_update);
			$time_result = $db->sql_query($time_update);
	
			if($result&&$time_result) //Both gotta happen...
				{	   
				  if(!isset($topic_id))
					{
    					  header('Location: index.php');
   							   break;
 				        }
				  else
					{
					  header('Location: viewtopic.php?t='.$topic_id);
					}
				}
			else
				{
					message_die(GENERAL_ERROR, $lang['Critical_Error'] . '
<a> ' . $lang['Return_To_Topic'] . ' </a>', __LINE__, __FILE__, $sql);
				}
		}
	else
		{
			message_die(CRITICAL_MESSAGE, $lang['Too_Soon'] . '
<a> ' . $lang['Return_To_Topic'] . ' </a>');
		}
}
}
?>
can someone?
the topic id is ok.
cuse after the voting to some user i get
http://www.itpro.org.il/modules.php?...=4&x=appl aud

if i change file-karma to file=viewtopic it gos back to the topic i want
if i chane the code in the install from:
Code:
   if ( ( $userdata['session_logged_in'] ) && ( $userdata['user_id'] != $poster_id ) ) 
   { 
      $applaud_alt = $lang['Applaud']; 
      $applaud_url = append_sid("karma.$phpEx?" . POST_TOPIC_URL . '=' . $topic_id . '&' . POST_USERS_URL . '=' . $poster_id . '&x=applaud'); 
      $applaud_img = '<img>'; 

      $smite_alt = $lang['Smite']; 
      $smite_url = append_sid("karma.$phpEx?" . POST_TOPIC_URL . '=' . $topic_id . '&' . POST_USERS_URL . '=' . $poster_id . '&x=smite'); 
      $smite_img = '<img>'; 
   }
to:
Code:
   if ( ( $userdata['session_logged_in'] ) && ( $userdata['user_id'] != $poster_id ) ) 
   { 
      $applaud_alt = $lang['Applaud']; 
      $applaud_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $topic_id . '&' . POST_USERS_URL . '=' . $poster_id . '&x=applaud'); 
      $applaud_img = '<img>'; 

      $smite_alt = $lang['Smite']; 
      $smite_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $topic_id . '&' . POST_USERS_URL . '=' . $poster_id . '&x=smite'); 
      $smite_img = '<img>'; 
   }
it gose back to the page i want after voting but dont add's point of karma to the user (it dont go to the karma.php file to do the changes in the DB)

i will appreciat any help
p.s.
my site is in hebrew
so if you want me to give u demo user and password and link to login page and forums just say.

regards,
Ofer
[/code]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-05-2007, 12:45 AM
Junior Member
 
Join Date: Mar 2007
Posts: 3
it seems that my problem is here:

Code:
         //update the database with current time() for voter 
         $time_update = "update " . USERS_TABLE . " set karma_time ='$time' where user_id ='$userdata[user_id]'"; 
         $result = $db->sql_query($karma_update); 
         $time_result = $db->sql_query($time_update); 
    
         if($result&&$time_result) //Both gotta happen... 
            {       
              if(!isset($topic_id)) 
               { 
                     header('Location: index.php'); 
                           break; 
                     } 
              else 
               { 
                 header('Location: viewtopic.php?t='.$topic_id); 
               } 
            } 
         else 
            { 
               message_die(GENERAL_ERROR, $lang['Critical_Error'] . '
<a> ' . $lang['Return_To_Topic'] . ' </a>', __LINE__, __FILE__, $sql); 
            } 
      } 
   else 
      { 
         message_die(CRITICAL_MESSAGE, $lang['Too_Soon'] . '
<a> ' . $lang['Return_To_Topic'] . ' </a>'); 
      } 
} 
}
because when i press the + or - for karma points it add the point' that meens hes going to the karma.PHP
but he dont enter to that code i Quoted.
any one knows what goes on here?
mybe i have to incloud some files ?
:roll:
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-07-2007, 01:35 AM
Junior Member
 
Join Date: Mar 2007
Posts: 3
:roll:
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I got a problem with php / nuke - superhero123 Theme packs 5 04-25-2006 03:21 PM
my site, and my nuke problem jadedillusions81 Nuke 7.x - General 0 08-11-2005 08:35 AM
problem installing php nuke chieu Nuke 7.x - General 10 02-27-2005 01:53 PM
Problem with Nuke Webpages Littlewyng Purged Topics 2 07-19-2003 09:27 AM
Problem going from one php nuke page to another jcovin Purged Topics 4 11-14-2002 08:19 AM


All times are GMT -5. The time now is 11:11 PM.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31