Topic Cost Issue?

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Topic Cost Issue?
Gaurav
CZ Super Newbie
Gaurav has been a member for over 20 year's 20 Year Member
Occupation: Student
Gender: Male
Status: Offline
Joined: Feb 09, 2004
0.01 posts per day
Posts: 55
Points: 2,165
 Yahoo Messenger  
I installed the Topic Cost Mod. I followed all the instructuions, but it still doesnt work. The DB was altered perfectly, I can configure the topic cost and the points cost in the Admin CP and those changes are reflected in the db. But when I post or make a new topic in that forum, it doesn't decrease my points, infact it increases them as usual. I am using Phpnuke 7.0 and its points system (and not the one avaialable @ portedmods).

I changed the user_points to points in function_post.php.....so the code looks like this

$topic_cost = ( $mode == 'newtopic' ) ? intval($row['topic_cost']) : intval($row['post_cost']);

      if ($topic_cost > 0)
      {
         if ($userdata['points'] < $topic_cost)
         {
            $message = ( $mode == 'newtopic' ) ? $lang['points_post_topic'] : $lang['points_post_reply'];
            message_die(GENERAL_MESSAGE, sprintf($lang['not_enough_points'], $board_config['points_name'], $message));
         }
         else {
            $sql = "UPDATE " . USERS_TABLE . "
               SET points = points - $topic_cost
                WHERE user_id = '{$userdata['user_id']}'";
            if ( !($db->sql_query($sql)) )
            {
               message_die(GENERAL_ERROR, 'Error charging', '', __LINE__, __FILE__, $sql);
            }
         }
      }


but the line After which I am supposed to add this code is bit different for my function_post.php

   message_die(GENERAL_MESSAGE, $lang['Flood_Error']);
                                }
                        }
                }
                if ( $mode == 'newtopic' ) { update_points(10); }
                if ( $mode == 'reply' ) { update_points(11); }
        }


I think that something is wrong with function_post.php as this is the only file which uses the points for the mod.

Any Kind of Help Will Be Appreciated!

Thanx!

Gaurav



_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#2   re: Topic Cost Issue?
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,440
   
if (intval($row['last_post_time']) > 0 && ($current_time - intval($row['last_post_time'])) < intval($board_config['flood_interval']))
                                {
                                        message_die(GENERAL_MESSAGE, $lang['Flood_Error']);
                                }
                        }
                }
                if ( $mode == 'newtopic' ) { update_points(10); }
                if ( $mode == 'reply' ) { update_points(11); }
        }
$topic_cost = ( $mode == 'newtopic' ) ? intval($row['topic_cost']) : intval($row['post_cost']);

      if ($topic_cost > 0)
      {
         if ($userdata['points'] < $topic_cost)
         {
            $message = ( $mode == 'newtopic' ) ? $lang['points_post_topic'] : $lang['points_post_reply'];
            message_die(GENERAL_MESSAGE, sprintf($lang['not_enough_points'], $board_config['points_name'], $message));
         }
         else {
            $sql = "UPDATE " . USERS_TABLE . "
               SET points = points - $topic_cost
                WHERE user_id = '{$userdata['user_id']}'";
            if ( !($db->sql_query($sql)) )
            {
               message_die(GENERAL_ERROR, 'Error charging', '', __LINE__, __FILE__, $sql);
            }
         }
      }




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   re: Topic Cost Issue?
Gaurav
CZ Super Newbie
Gaurav has been a member for over 20 year's 20 Year Member
Occupation: Student
Gender: Male
Status: Offline
Joined: Feb 09, 2004
0.01 posts per day
Posts: 55
Points: 2,165
 Yahoo Messenger  
Thanx Telli, for posting the code, but it still gives the same result

Did you change anything in that code except user_points --> points?

It seems like it is updating the points using
if ( $mode == 'newtopic' ) { update_points(10); }
                if ( $mode == 'reply' ) { update_points(11); }

and it doesn't even reach upto the topic cost....can it be nesting of the brackets?

Did anyone else tried it on 7.0?

Thanx a lot!



_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#4   re: Topic Cost Issue?
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,440
   
I messed with it some but it was just easier to add the function right into the groups menu so if you dont mind testing it (i tested it on 2 sites and it works fine) then just install this mod. Please post back your result.
[ Register or login to view links on this board. ]

Nuke 7.0+




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#5   re: Topic Cost Issue?
Gaurav
CZ Super Newbie
Gaurav has been a member for over 20 year's 20 Year Member
Occupation: Student
Gender: Male
Status: Offline
Joined: Feb 09, 2004
0.01 posts per day
Posts: 55
Points: 2,165
 Yahoo Messenger  
Sorry for posting so late. I was busy with other stuff.

I tried it today. It workde for me but it has issues.

1. It won't let me select a particular forum. It implements the cost system in all the forums.

2. It fails to stop user from posting if he haspoints less than reqd. eg. I have 10 points and the requirment is 50 points. So It lets me post, but my points after posting are "-40".

Thanx for your help.

Gaurav




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#6   re: Topic Cost Issue?
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,440
   
I dont know if this will work but if you wouldnt mind testing it that would be great. Just replace the whole new function with this one:

function update_pointsCZ($id) {
    global $user_prefix, $prefix, $db, $user;
    if (is_user($user)) {
   if(!is_array($user)) {
       $user1 = base64_decode($user);
       $user1 = explode(":", $user1);
           $username = "$user1[1]";
   } else {
           $username = "$user1[1]";
   }
       $row = $db->sql_fetchrow($db->sql_query("SELECT points FROM ".$prefix."_groups_points WHERE id='$id'"));
       $row[points] = intval($row['points']);
       if ($db->sql_numrows($db->sql_query("SELECT points FROM ".$prefix."_users WHERE username='$username'")) < $row[points]) {
       message_die(GENERAL_MESSAGE, 'You do not have enough points for this post!');
} else {
       if ($db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_groups")) > 0) {
       $row = $db->sql_fetchrow($db->sql_query("SELECT points FROM ".$prefix."_groups_points WHERE id='$id'"));
       $row[points] = intval($row['points']);
       $db->sql_query("UPDATE ".$user_prefix."_users SET points=points-$row[points] WHERE username='$username'");
   }
    }
}
}




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#7   re: Topic Cost Issue?
Gaurav
CZ Super Newbie
Gaurav has been a member for over 20 year's 20 Year Member
Occupation: Student
Gender: Male
Status: Offline
Joined: Feb 09, 2004
0.01 posts per day
Posts: 55
Points: 2,165
 Yahoo Messenger  
I didn't try this code, as it will still work for all the forums, but I am looking for something which can be config. for a particular forum

I think I spotted a mistake in the instalation file.

$sql = "UPDATE " . USERS_TABLE . "
               SET points = points - $topic_cost
                WHERE user_id = '{$userdata['user_id']}'";
            if ( !($db->sql_query($sql)) )


Isnt a _prefix missing before the table USERS_TABLE ?



_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#8   re: Topic Cost Issue?
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,440
   
No the USERS_TABLE is defined in the includes/constants.php as nuke_users.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#9   re: Topic Cost Issue?
Gaurav
CZ Super Newbie
Gaurav has been a member for over 20 year's 20 Year Member
Occupation: Student
Gender: Male
Status: Offline
Joined: Feb 09, 2004
0.01 posts per day
Posts: 55
Points: 2,165
 Yahoo Messenger  
ohhh thnx

Did u/anybody tried instaling w/ 7.0's point system? May be its me who made some mistake in instalation..?

thanx for your help

Gaurav




_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#10   re: Topic Cost Issue?
Mxdm
CZ Newbie
 Codezwiz Site Donator
Mxdm has been a member for over 19 year's 19 Year Member
netherlands.gif
Gender: Male
Status: Offline
Joined: Jan 07, 2005
0.00 posts per day
Posts: 4
Points: 3,364
   
This seems like a nice mod anyone ported it already for the full 100% to nuke? would be great if it worked with cashmod as well.



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum