PDA

View Full Version : A modification


jcga1992
11-01-2011, 02:34 PM
First, sorry for my bad english....

In this moment when i vote one adoptable i get money.

The modification that i want do is, when someone vote my adoptable I get the money.

I only know a little PHP if someone can show me how do it...

Thank you so much.

jcga1992
11-06-2011, 03:22 PM
Please.. Nobody can help me :cfrown:

SilverDragonTears
11-06-2011, 03:31 PM
So instead of members receiving money when they level up an adopt you want the person who's adopt is clicked to get the money? Or both?

Hall of Famer
11-06-2011, 05:34 PM
Umm this should be quite simple php programming. What I'd do is to edit the levelup.php file and find the line where money is added to users. If I recall, the user is specified to be $loggedinname, which corresponds to the one who click on adoptables. All that needs to b done is to change this variable to the actual owner of the pet getting clicks. Lemme know if this is helpful or not, if you really ain't comfortable with php I can show you a sample Php code on how to make such modification.

jcga1992
11-07-2011, 05:20 AM
So instead of members receiving money when they level up an adopt you want the person who's adopt is clicked to get the money? Or both?

Only the person who's adopt is clicked

Umm this should be quite simple php programming. What I'd do is to edit the levelup.php file and find the line where money is added to users. If I recall, the user is specified to be $loggedinname, which corresponds to the one who click on adoptables. All that needs to b done is to change this variable to the actual owner of the pet getting clicks. Lemme know if this is helpful or not, if you really ain't comfortable with php I can show you a sample Php code on how to make such modification.

I think you say here?

if($owned_adoptable['isfrozen'] == "no"){
$reward = clickreward(grabanysetting('rewardmoney'), $GLOBALS['username'], $GLOBALS['money']);
$newamount = $GLOBALS['money'] + $reward;
runquery("UPDATE {$GLOBALS['prefix']}users SET `money` = '{$newamount}' WHERE `username` = '{$loggedinname}'");
$article_content = $article_content . "<div align='center'><br />You have earned {$reward} ".grabanysetting('cost')." for leveling up this adoptable. <br />You now have {$newamount} ".grabanysetting('cost')."</div>";

What i should put in $loggedinname. Thank you a lot.

Hall of Famer
11-07-2011, 11:58 AM
Well I would do the following changes:


if($owned_adoptable['isfrozen'] == "no"){
$result = runquery("SELECT * FROM {$prefix}users WHERE username='{$owned_adoptable['owner']}'");
$user = mysql_fetch_array($result);
$reward = clickreward(grabanysetting('rewardmoney'), $owned_adoptable['owner'], $user['money']);
$newamount = $user['money'] + $reward;
runquery("UPDATE {$GLOBALS['prefix']}users SET `money` = '{$newamount}' WHERE `username` = '{$owned_adoptable['owner']}'"); As you can see, the program looks a bit confusing 'cause the adoptable owner's money data cannot be easily retrieved from database. The mysql SELECT query has to be executed and mysql_fetch_array needs to be manipulated. Also the $article_content line is removed for a good reason. Try this on your site and lemme know if it works.

jcga1992
11-07-2011, 01:34 PM
WOW it work perfectly!!! Thank you!!!:smile:

Hall of Famer
11-07-2011, 02:31 PM
You are very welcome, glad it works for you.