[2.0.18] Cash Mod

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
1036
66%
Very Good
239
15%
Good
121
8%
Fair
36
2%
Poor
126
8%
 
Total votes: 1558

jerx
Registered User
Posts: 167
Joined: Fri Sep 02, 2005 4:27 am

Post by jerx » Thu Dec 28, 2006 7:55 pm

Brf wrote:
jerx wrote: not allowing an action which costs cash


The only "Action" allowed by Cash Mod, is donating cash, which as you already admitted, seems to be fixed. Any other actions are not done by Cash Mod itself, and therefore would have to be checked by the mod which is doing the spending.


I am talking about the private messaging. This is a default cash mod feature. There is also a setting in admin panel to set the cash amount. I would like to use a negative value.
mbgb14 wrote: AFAIK, no it doesn't have an uninstall :(
And can someone explain how to do it manually for me?


Look at the instructions. Usually you had to find a piece of code and then you had to add new code. To reverse it, you have to do the opposite. You have to find the new code and delete it.
If you had to find some code and had to replace that with new code, you now have to find the new code and replace with the old one.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51870
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Post by Brf » Thu Dec 28, 2006 8:33 pm

jerx wrote: I am talking about the private messaging. This is a default cash mod feature. There is also a setting in admin panel to set the cash amount. I would like to use a negative value.


We were talking about a problem within Cash Mod allowing you to spend more cash than you have. I replied that the only way to "spend" cash within the Cash Mod is to donate.

There is no current way within the Cash Mod to charge anyone for posting or private messaging.

jerx
Registered User
Posts: 167
Joined: Fri Sep 02, 2005 4:27 am

Post by jerx » Fri Dec 29, 2006 1:06 pm

Brf wrote:
jerx wrote: I am talking about the private messaging. This is a default cash mod feature. There is also a setting in admin panel to set the cash amount. I would like to use a negative value.


We were talking about a problem within Cash Mod allowing you to spend more cash than you have. I replied that the only way to "spend" cash within the Cash Mod is to donate.

There is no current way within the Cash Mod to charge anyone for posting or private messaging.


Sorry, I am unable to follow you. Please do not feel offended. I really appreciate your hard work supporting this mod and phpbb. For me as a non coder it looks like there is a problem with the cash mod. I mean by default you are able to set earnings for posting and private messaging. If you set these to be negative, these actions become "spending" actions and people possibly get into debt no matter how you set up "allow negative cash" feature.

I have seen posts about other mods like zarath' s shop mod causing negative cash amounts. These people were told that this is a problem of the other mod. I can' t tell, what the reason is, but either way this is different anyway. Posting and private messaging are default phpbb features and there is no mod author involved. Moreover the standard cash mod gives you the ability to set cash amounts for these actions.

There is another issue which makes me think the "allow negative" feature does not work. If you have a user who has -8 cash. Now he is able to donate 8 cash to another user. If the other user has less than 8 cash, he will have a negative balance after receiving the "donation".

Preventing people from donating their negative balance to other users has been fixed. But it was not an updated cash mod version, but it was RMcGirr83 who came up with a solution:
http://www.phpbb.com/phpBB/viewtopic.ph ... sh#2556020
Last edited by jerx on Fri Dec 29, 2006 7:47 pm, edited 1 time in total.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51870
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Post by Brf » Fri Dec 29, 2006 2:28 pm

jerx wrote: I have seen posts about other mods like zarath' s shop mod causing negative cash amounts. These people were told that this is a problem of the other mod. I can' t tell, what the reason is, but either way this is different anyway.
That is not a Cash Mod problem because no Cash Mod code is being used to withdraw the cash.
Posting and private messaging are default phpbb features and there is no mod author involved. Moreover the standard cash mod gives you the ability to set cash amounts for these actions.
Yes. I have never investigated putting negative amounts for posting earnings. Have you?
If you have a user who has -8 cash. Now he is able to donate 8 cash to another user. If the other user has less than 8 cash, he will have a negative balance after receiving the "donation".
I am pretty sure you cannot donate a negative amount with the current version of Cash Mod. In my testing I have never successfully donated a negative amount.

jerx
Registered User
Posts: 167
Joined: Fri Sep 02, 2005 4:27 am

Post by jerx » Fri Dec 29, 2006 7:46 pm

Brf wrote:
jerx wrote: I have seen posts about other mods like zarath' s shop mod causing negative cash amounts. These people were told that this is a problem of the other mod. I can' t tell, what the reason is, but either way this is different anyway.
That is not a Cash Mod problem because no Cash Mod code is being used to withdraw the cash.
Posting and private messaging are default phpbb features and there is no mod author involved. Moreover the standard cash mod gives you the ability to set cash amounts for these actions.
Yes. I have never investigated putting negative amounts for posting earnings. Have you?
If you have a user who has -8 cash. Now he is able to donate 8 cash to another user. If the other user has less than 8 cash, he will have a negative balance after receiving the "donation".
I am pretty sure you cannot donate a negative amount with the current version of Cash Mod. In my testing I have never successfully donated a negative amount.


Yes, I have used negative amounts. I want to charge for private messages, but I have also tested charging postings. After posting your cash balance will be deducted by the configured cash amount. The setting "allow negative cash" does not prevent people from going negative.

And you can even donate the negative cash amount. The fix I was talking about in my previous post is not an official cash mod fix. The most recent cash mod version does not prevent people from donating negative cash amounts.

Unfortunately you cannot set a user' s cash to a negative value, so you need to edit the cash in the database or configure cash mod to charge for posting/private messaging in order to reproduce what I was talking about. If you have reached a negative cash amount, you can donate it to other users. Do not type the minus sign (if you do so, nothing happens). The odd thing is that it doesn' t matter what number (>0) you type into the field, your cash amount will always be 0 after donation. The balance of the other user will be deducted by the cash amount you have been in debt. You are not able to gain cash, if your cash is 0 or more.

Examples:
your cash before donation, donation amount, your cash after d., other user' s cash before d., other user' s cash after d.
-10, 5, 0, 10, 0
-10, 10, 0, 10, 0
-10, 20, 0, 10, 0
-10, 10, 0, 20, 10
-10, 10, 0, 5, -5
0, 10, 0, 10, 10
10, 15, 0, 10, 20
10, 5, 5, 10, 15

With the donate fix, I was able to stop people from cheating. But it does not prevent them from sending as much pms as they want.

I see two possible solutions:
1. bugfix "allow negative cash" feature
2. Check cash amount, before allowing private messaging.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51870
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Post by Brf » Fri Dec 29, 2006 11:32 pm

LOL..... as a longtime coder, I can deduce the trap that causes the negative amount to be donated.

I have never tried using a negative amount as a reward for posting... and I dont think the Cash Mod was designed to allow you to do that. In its present form, it cannot prevent a post from being made to stop a user from going negative... since the reward is calculated after the post is already made.

The best you could do, without adding some extra code, is to stop the cash from going negative... which would not accomplish what you want to do, since it would allow a user to made unlimited posts with zero cash.

The best you could do is use one of the pay-to-post add-ons.

hatake
Registered User
Posts: 9
Joined: Wed Dec 20, 2006 8:08 am
Location: Ontario
Contact:

Post by hatake » Sat Dec 30, 2006 9:05 am

Hi, well I have a question about this MOD, okay I have it installed and everything is good but when I install a new forum theme, the Mods dont work on the new theme I just installed.

When I look at the MOD setting and history, I notice that the mods have been proccesed with the older themes and work fine. but a new theme wont work since it hasent been proccessed with the MODS. any idea how to procces the new theme so it can work with both MODs on my forum?

Current MODs installed: Cash MOD, Easy MOD,
thanks in advance.

mbgb14
Registered User
Posts: 7
Joined: Thu Apr 06, 2006 11:42 pm

Post by mbgb14 » Sat Dec 30, 2006 9:09 am

hatake wrote: Hi, well I have a question about this MOD, okay I have it installed and everything is good but when I install a new forum theme, the Mods dont work on the new theme I just installed.

When I look at the MOD setting and history, I notice that the mods have been proccesed with the older themes and work fine. but a new theme wont work since it hasent been proccessed with the MODS. any idea how to procces the new theme so it can work with both MODs on my forum?

Current MODs installed: Cash MOD, Easy MOD,
thanks in advance.


I was wondering this too! Excellent question - can't wait for an answer.

sanya18
Registered User
Posts: 6
Joined: Wed Dec 20, 2006 3:52 am

Post by sanya18 » Sat Dec 30, 2006 10:18 am

hatake wrote: Hi, well I have a question about this MOD, okay I have it installed and everything is good but when I install a new forum theme, the Mods dont work on the new theme I just installed.

When I look at the MOD setting and history, I notice that the mods have been proccesed with the older themes and work fine. but a new theme wont work since it hasent been proccessed with the MODS. any idea how to procces the new theme so it can work with both MODs on my forum?

Current MODs installed: Cash MOD, Easy MOD,
thanks in advance.


you need to manually adjust the new theme:

copy the [cashmod directory]/templates/subsilver/*.* to your new theme's directory. next, apply the changes to the new theme core files:

Code: Select all

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

# 
#-----[ FIND ]------------------------------------------ 
# in subSilver, the full line is 
#	  <th class="thTop" nowrap="nowrap">{L_POSTS}</th>
#
	{L_POSTS}

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# on the next line
#
	  <!-- BEGIN cashrow -->
	  <th class="thTop" nowrap="nowrap">{cashrow.NAME}</th>
	  <!-- END cashrow -->

# 
#-----[ FIND ]------------------------------------------ 
# in subSilver, the full line is 
#	  <td class="{memberrow.ROW_CLASS}" align="center" valign="middle"><span class="gen">{memberrow.POSTS}</span></td>
#
	 {memberrow.POSTS}

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# on the next line
#
	  <!-- BEGIN cashrow -->
	  <td class="{memberrow.ROW_CLASS}" align="center" valign="middle"><span class="gen">{memberrow.cashrow.CASH_DISPLAY}</span></td>
	  <!-- END cashrow -->

# 
#-----[ FIND ]------------------------------------------ 
# in subSilver, the full line is 
#	  <td class="catBottom" colspan="8" height="28">&nbsp;</td>
# 
colspan="8"

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
8

# 
#-----[ IN-LINE REPLACE WITH ]------------------------------------------ 
#
{NUM_COLUMNS}

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

# 
#-----[ FIND ]------------------------------------------ 
# in subSilver, the full line is 
#		  <td> <b><span class="gen">{INTERESTS}</span></b></td>
# 
{INTERESTS}

# 
#-----[ FIND ]------------------------------------------ 
# (on the next line)
# 
		</tr>
# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
		{CASH}

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

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

#
#-----[ IN-LINE FIND ]------------------------------------------ 
#
{postrow.POSTER_FROM}

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
#
<br />{postrow.CASH}

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM 
simply apply this to your new template files instead of applying it to subsilver. Worked fine for me.

jerx
Registered User
Posts: 167
Joined: Fri Sep 02, 2005 4:27 am

Post by jerx » Sat Dec 30, 2006 12:12 pm

Brf wrote: LOL..... as a longtime coder, I can deduce the trap that causes the negative amount to be donated.

I have never tried using a negative amount as a reward for posting... and I dont think the Cash Mod was designed to allow you to do that. In its present form, it cannot prevent a post from being made to stop a user from going negative... since the reward is calculated after the post is already made.

The best you could do, without adding some extra code, is to stop the cash from going negative... which would not accomplish what you want to do, since it would allow a user to made unlimited posts with zero cash.

The best you could do is use one of the pay-to-post add-ons.


I looked at the topic cost addon and the donate fix for cash mod. By doing this, I noticed that the donate fix is not bullet proof. It only hides the donate link. If you know the donate url (http://yourdomain.com/cash.php?mode=don ... e&u=userid), it is very easy to bypass the limitation. This needs to be improved.

The topic cost addon seems to handle it properly. But I only want to charge for sending private messages, so I need to adapt the code to the private messaging function. This code needs to be added to /includes/functions_post.php:

Code: Select all

#
#-----[ FIND ]------------------------------------------ 
#
					message_die(GENERAL_MESSAGE, $lang['Flood_Error']);
				}
			}
		}
	}

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
		$sql = "SELECT *
			FROM " . FORUMS_TABLE . "
			WHERE forum_id = '$forum_id'";
		if ( $result = $db->sql_query($sql) )
		{
			if ( !( $row = $db->sql_fetchrow($result)) )
			{
				message_die(GENERAL_MESSAGE, "Critical Error!");
			}
		}

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

		if ($topic_cost > 0)
		{
			if ($userdata['user_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 user_points = user_points - $topic_cost
					 WHERE user_id = '{$userdata['user_id']}'";
				if ( !($db->sql_query($sql)) )
				{
					message_die(GENERAL_ERROR, 'Error charging', '', __LINE__, __FILE__, $sql);
				}
			}
		}
I think you need to add a similar code to privmsg.php, since there is no extra functions file for private messages. Maybe you could add it to functions_post.php, because the private message file needs it, too.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51870
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Post by Brf » Sat Dec 30, 2006 12:34 pm

It appears this addon is adding a column to each forum datarow, to tell what its cost is... That piece of code is retrieving the cost from the forums table. Since you will be charging for PMs, rather than forum posts, you would store this cost in the config table instead, since it is the same amount for all PMs. There would be no need to retrieve that, since it would be in $board_config['PM_cost'], or whatever.

HelenaH
Registered User
Posts: 11
Joined: Fri Dec 29, 2006 9:27 pm

Post by HelenaH » Sat Dec 30, 2006 3:21 pm

I tryed to load the file in the root directory then it had me log on which i did then i got this error message please Help

INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable',0);
+++ Error: Duplicate entry 'cash_disable' for key 1

INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_display_after_posts',1);
+++ Error: Duplicate entry 'cash_display_after_posts' for key 1

INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_post_message','You earned %s for that post');
+++ Error: Duplicate entry 'cash_post_message' for key 1

INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable_spam_num',10);
+++ Error: Duplicate entry 'cash_disable_spam_num' for key 1

INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable_spam_time',24);
+++ Error: Duplicate entry 'cash_disable_spam_time' for key 1

INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_disable_spam_message','You have exceeded the alloted amount of posts and will not earn anything for your post');
+++ Error: Duplicate entry 'cash_disable_spam_message' for key 1

INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_installed','yes');
+++ Error: Duplicate entry 'cash_installed' for key 1

INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_version','2.2.3');
+++ Error: Duplicate entry 'cash_version' for key 1

INSERT INTO phpbb_config (config_name, config_value) VALUES ('points_name','Points');
+++ Error: Duplicate entry 'points_name' for key 1

INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_adminnavbar','1');
+++ Error: Duplicate entry 'cash_adminnavbar' for key 1

INSERT INTO phpbb_config (config_name, config_value) VALUES ('cash_adminbig','0');
+++ Error: Duplicate entry 'cash_adminbig' for key 1

CREATE TABLE phpbb_cash (
cash_id smallint(6) NOT NULL auto_increment,
cash_order smallint(6) NOT NULL default '0',
cash_settings smallint(4) NOT NULL default '3313',
cash_dbfield varchar(64) NOT NULL default 'user_cash',
cash_name varchar(64) NOT NULL default 'cash',
cash_default int(11) NOT NULL default '0',
cash_decimals tinyint(2) NOT NULL default '0',
cash_imageurl varchar(255) NOT NULL default ' ',
cash_exchange int(11) NOT NULL default '1',
cash_perpost int(11) NOT NULL default '25',
cash_postbonus int(11) NOT NULL default '2',
cash_perreply int(11) NOT NULL default '25',
cash_maxearn int(11) NOT NULL default '75',
cash_perpm int(11) NOT NULL default '0',
cash_perchar int(11) NOT NULL default '20',
cash_allowance tinyint(1) NOT NULL default '0',
cash_allowanceamount int(11) NOT NULL default '0',
cash_allowancetime tinyint(2) NOT NULL default '2',
cash_allowancenext int(11) NOT NULL default '0',
cash_forumlist varchar(255) NOT NULL default ' ',
PRIMARY KEY (cash_id)
);
+++ Error: Table 'phpbb_cash' already exists

CREATE TABLE phpbb_cash_events (
event_name varchar(32) NOT NULL default ' ',
event_data varchar(255) NOT NULL default ' ',
PRIMARY KEY (event_name)
);
+++ Error: Table 'phpbb_cash_events' already exists

CREATE TABLE phpbb_cash_exchange (
ex_cash_id1 int(11) NOT NULL default '0',
ex_cash_id2 int(11) NOT NULL default '0',
ex_cash_enabled int(1) NOT NULL default '0',
PRIMARY KEY (ex_cash_id1,ex_cash_id2)
);
+++ Error: Table 'phpbb_cash_exchange' already exists

CREATE TABLE phpbb_cash_groups (
group_id mediumint(6) NOT NULL default '0',
group_type tinyint(2) NOT NULL default '0',
cash_id smallint(6) NOT NULL default '0',
cash_perpost int(11) NOT NULL default '0',
cash_postbonus int(11) NOT NULL default '0',
cash_perreply int(11) NOT NULL default '0',
cash_perchar int(11) NOT NULL default '0',
cash_maxearn int(11) NOT NULL default '0',
cash_perpm int(11) NOT NULL default '0',
cash_allowance tinyint(1) NOT NULL default '0',
cash_allowanceamount int(11) NOT NULL default '0',
cash_allowancetime tinyint(2) NOT NULL default '2',
cash_allowancenext int(11) NOT NULL default '0',
PRIMARY KEY (group_id,group_type,cash_id)
);
+++ Error: Table 'phpbb_cash_groups' already exists

CREATE TABLE phpbb_cash_log (
log_id int(11) NOT NULL auto_increment,
log_time int(11) NOT NULL default '0',
log_type smallint(6) NOT NULL default '0',
log_action varchar(255) NOT NULL default ' ',
log_text varchar(255) NOT NULL default ' ',
PRIMARY KEY (log_id)
);
+++ Error: Table 'phpbb_cash_log' already exists



Finished


SQL Installation complete
Please delete this file (sql_install.php).
If you have any problems, please visit phpbb.com (CashMod v 2.2.3 Support Thread) and ask for help

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51870
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Post by Brf » Sat Dec 30, 2006 3:49 pm

HelenaH wrote: I tryed to load the file in the root directory then it had me log on which i did then i got this error message please Help


What is your question? Those error messages say that you have already run the SQL install at least once.

HelenaH
Registered User
Posts: 11
Joined: Fri Dec 29, 2006 9:27 pm

Post by HelenaH » Sat Dec 30, 2006 3:51 pm

ok so i have loaded it i guess so i have delted the install file like it say Now what where should i be seeing the changes cause i dont see anything different

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51870
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Post by Brf » Sat Dec 30, 2006 3:53 pm

Did you install the mod? All that install file does is update the database.

Post Reply

Return to “[2.0.x] MOD Database Releases”