[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

User avatar
karlsemple
Former Team Member
Posts: 39802
Joined: Mon Nov 01, 2004 8:54 am
Location: Hereford, UK
Contact:

Post by karlsemple » Sat Dec 09, 2006 12:21 pm

Brf wrote: The template object in this class, is not the actual template object used in the rest of phpBB. It is a template_plus object defined at the top of this function. The template_plus object (defined at the top of classes_cash) redefines assign_block_var_from_handle.



fair enough, I only quickly looked through the file to help the user in IRC, just wondering what was causing their error, I has not noticed the function at the start of the file, although I see it now :) ........ back to trying to track this one down.
Image

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

Post by Brf » Sat Dec 09, 2006 12:25 pm

Yes. This has been a bad bugaboo lately. I had thought we fixed the last bug when we started suggesting _POST and _GET, instead of the longer names at the beginning of profile.php for php-5 users.... but omitting that causes a "function called on a non-object" error, and we are not seeing any errors here. Maybe there is a problem with extending the template class or something.

User avatar
karlsemple
Former Team Member
Posts: 39802
Joined: Mon Nov 01, 2004 8:54 am
Location: Hereford, UK
Contact:

Post by karlsemple » Sat Dec 09, 2006 12:31 pm

Brf wrote: Yes. This has been a bad bugaboo lately. I had thought we fixed the last bug when we started suggesting _POST and _GET, instead of the longer names at the beginning of profile.php for php-5 users.... but omitting that causes a "function called on a non-object" error, and we are not seeing any errors here. Maybe there is a problem with extending the template class or something.



See I would normally put it down to bad user editing, but if that were the case surely copying the code from the cash_viewprofile.tpl to the main profile_view_body.tpl would result in the same blank page., but it does not...... seems to be a temporary fix but would be nice to find out why it is doing it. Anyway time to retire as my bed is calling me, maybe you guys who support this mod will work it out :)
Image

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

Post by Brf » Sat Dec 09, 2006 1:30 pm

Ahh.... I see now.
He is redefining the assign_from_handle, so he can assign a sub-template to a block variable -- like he is doing in viewtopic... But why is he doing it here? He is assigning to "CASH", which should work fine with the old template.....

A question for those of you that have never gotten cash to show in viewprofile.... Have you gotten it to show in viewtopic?

Those are the two spots the template_plus are used.
Last edited by Brf on Sat Dec 09, 2006 1:42 pm, edited 1 time in total.

K34nu
Registered User
Posts: 7
Joined: Thu Dec 07, 2006 11:55 am

Post by K34nu » Sat Dec 09, 2006 1:40 pm

Would someone be willing to contact me via e-mail or MSN Messenger, and install this script for me?

Of corse im not saying can ya do it for free. I'll give you FREE, 20GB Hosting! (Will go up if someone contacts me fast) Unlimated bandwidth! Please take this offer, im in great need of your help! (For 2 years.. if you wanna see a screenshot of my package, i'll give ya it.. But yeah)

So can someone please e-mail me or contact me via msn messenger, the two addresses are noted below.

Thanks!
-Keanu

e-mail:
K34nu.aro@googlemail.com
Msn:
thesamuraiblade@hotmail.com

Thanks once agian!

User avatar
GeorgiePorgie
Registered User
Posts: 80
Joined: Thu Aug 03, 2006 3:19 am
Location: 37° 42' N, 122° 05' W
Contact:

Post by GeorgiePorgie » Sat Dec 09, 2006 5:11 pm

Brf wrote: A question for those of you that have never gotten cash to show in viewprofile.... Have you gotten it to show in viewtopic?

Yes!

I do see the user's currency amounts on viewtopic, but they do not appear on viewprofile. This is the true when I log in as admin, and also when I log on as a regular user. Currency always appears properly on viewtopic, but never appears on viewprofile.

If someone comes up with a fix for that, I'll definitely give it a test.

FYI, just installed this mod yesterday (did it manually, sans EasyMod) and most everything appears to be OK - except for a handful of issues that are already noted in this thread.
Image

User avatar
GeorgiePorgie
Registered User
Posts: 80
Joined: Thu Aug 03, 2006 3:19 am
Location: 37° 42' N, 122° 05' W
Contact:

Post by GeorgiePorgie » Sat Dec 09, 2006 5:38 pm

I have a question about using Cash Mod with a php site that has been intetegrated with phpBB (the php site uses the phpBB session for log in, etc.)

As the Cash Mod author instructed at the beginning of the thread, you can add this to your php site to allow your php site to use Cash Mod:

Code: Select all

define('IN_CASHMOD', true);
I did that, so now the code that my php site uses to integrate with phpBB and the Cash Mod looks like this:

Code: Select all

define('IN_PHPBB', true); 
define('IN_CASHMOD', true);
$site_root_path = './';
$phpbb_root_path2 = '/forum/';
$phpbb_root_path = $site_root_path . $phpbb_root_path2; 
include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.php'); 
$userdata = session_pagestart($user_ip, PAGE_INDEX); 
init_userprefs($userdata);
That appears to be working fine. In my php site, I am able to get the user's currency amount and display it like this:

Code: Select all

echo $userdata['user_dollars'];
So reading the user's currency value is no trouble. However, at times I will want to increase or decrease the user's currency based on events that occur on my php site (not on my forum).

In other words, my php page sees that you have $50.00 when you arrive. You do something on my php page that should earn you $20.00. From my php page, I need to update your currency amount to show that you have $70.00 instead of $50.00.

What is the best or easiest way for the php page to update the new amount to the phpBB database? Does the Cash Mod API provide a quick way of doing that? I checked the post in this thread about the API, and it leads one to believe that there are undocumented features. So I'm assuming (hoping) there are features that some of you are using that I might not be aware of.

Any advice that you have to offer will be much appreciated.

Thanks :)
Image

User avatar
Scriptmaster10
Registered User
Posts: 107
Joined: Mon Aug 29, 2005 5:47 pm
Location: The Heart of England

Post by Scriptmaster10 » Sat Dec 09, 2006 5:53 pm

GeorgiePorgie wrote:
Brf wrote:A question for those of you that have never gotten cash to show in viewprofile.... Have you gotten it to show in viewtopic?

Yes!

I do see the user's currency amounts on viewtopic, but they do not appear on viewprofile. This is the true when I log in as admin, and also when I log on as a regular user. Currency always appears properly on viewtopic, but never appears on viewprofile.

If someone comes up with a fix for that, I'll definitely give it a test.

FYI, just installed this mod yesterday (did it manually, sans EasyMod) and most everything appears to be OK - except for a handful of issues that are already noted in this thread.

ditto.

alextee_2000
Registered User
Posts: 4
Joined: Fri Oct 20, 2006 8:58 pm

Post by alextee_2000 » Sat Dec 09, 2006 7:38 pm

Brf wrote: In Cash Admin Cash Settings, change your "Currency Style" from "Postfix" to "Prefix".


thank Brf

its work:)

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

Post by Brf » Sat Dec 09, 2006 7:49 pm

GeorgiePorgie wrote:

Code: Select all

echo $userdata['user_dollars'];


Actually, the standard way would be

Code: Select all

$c_cur = $cash->currency(1);
echo $userdata[$c_cur->db()];
No. The API does not provide a quick way to change a user's cash. You would have to build the SQL statement and update it yourself.
Last edited by Brf on Sat Dec 09, 2006 7:55 pm, edited 1 time in total.

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

Post by Brf » Sat Dec 09, 2006 7:53 pm

OK... both of you with the viewprofile problems.... before we try anything more drastic... lets just try a little bandaid, and see if it works:

Look for this line in includes/classes_cash.php:

Code: Select all

$template->assign_block_var_from_handle('CASH', 'cm_viewprofile');
and patch it to this:

Code: Select all

$template->assign_var_from_handle('CASH', 'cm_viewprofile');

User avatar
GeorgiePorgie
Registered User
Posts: 80
Joined: Thu Aug 03, 2006 3:19 am
Location: 37° 42' N, 122° 05' W
Contact:

Post by GeorgiePorgie » Sat Dec 09, 2006 8:51 pm

Brf wrote: OK... both of you with the viewprofile problems.... before we try anything more drastic... lets just try a little bandaid, and see if it works:

Look for this line in includes/classes_cash.php:

Code: Select all

$template->assign_block_var_from_handle('CASH', 'cm_viewprofile');
and patch it to this:

Code: Select all

$template->assign_var_from_handle('CASH', 'cm_viewprofile');


Thanks for the help! I applied your bandaid, but without success.

So I'll be watching closely and I'll be willing to try anything else that you may come up with. This profile problem isn't critical for my needs so it isn't a big deal if I never do get it working, but it would be nice to have it.
Brf wrote: The API does not provide a quick way to change a user's cash. You would have to build the SQL statement and update it yourself.

I suspected that was the case but I wasn't sure. Thanks for the confirmation!
Image

K34nu
Registered User
Posts: 7
Joined: Thu Dec 07, 2006 11:55 am

Post by K34nu » Sun Dec 10, 2006 1:48 am

Okay, messaged, Mod installed. Hosting given. Thanks!
Brilliant script!
Thanks agian!

-Keanu

User avatar
karlsemple
Former Team Member
Posts: 39802
Joined: Mon Nov 01, 2004 8:54 am
Location: Hereford, UK
Contact:

Post by karlsemple » Sun Dec 10, 2006 6:16 am

GeorgiePorgie wrote: I do see the user's currency amounts on viewtopic, but they do not appear on viewprofile. This is the true when I log in as admin, and also when I log on as a regular user. Currency always appears properly on viewtopic, but never appears on viewprofile.

If someone comes up with a fix for that, I'll definitely give it a test.
.


Open profile_view_body.tpl

Find:

Code: Select all

 {CASH}
Replace With:

Code: Select all

<!-- BEGIN cashrow -->
<tr> 
  <td valign="middle" align="right" nowrap="nowrap"><span class="gen">{cashrow.CASH_NAME}:</span></td>
  <td><span class="gen"><b>{cashrow.CASH_AMOUNT}</b></span></td>
</tr>
<!-- END cashrow -->
<!-- BEGIN switch_cashlinkson -->
<tr>
  <td valign="middle" align="right" nowrap="nowrap"></span>
  <td><span class="gen">
<!-- BEGIN cashlinks -->
	[ <a href="{switch_cashlinkson.cashlinks.U_LINK}" class="genmed">{switch_cashlinkson.cashlinks.L_NAME}</a> ]
<!-- END cashlinks -->
  </span></td>
</tr>
<!-- END switch_cashlinkson -->
A temp fix of course :)
Image

User avatar
GeorgiePorgie
Registered User
Posts: 80
Joined: Thu Aug 03, 2006 3:19 am
Location: 37° 42' N, 122° 05' W
Contact:

Post by GeorgiePorgie » Sun Dec 10, 2006 7:15 am

karlsemple wrote: A temp fix of course :)

And it was a successful temp fix. :)

Thanks very much for the help!
Image

Post Reply

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