#1
|
|||
|
|||
Help altering levelup.php
Hello. :3
I've recently been trying to add a line to the page you see when leveling an adoptable... and failing. X3 We have an adoptable with a promocode attached to each level. The rewards system sends it to the pet owner, of course, but we would like to have a link displayed on the levelup page as a thank you to the person clicking. I need the page to check if the adoptable is type "Happy Birthday". If yes, I need it to check the current level and retrieve the associated promocode. And then I need to make it display a little message with the link containing the promocode. And I can't figure how to do it. >.< I only know as much php as I've taught myself, and I've no idea how mysql works. I think I may have developed an irrational fear of it. XD So I come to you, and beg your help and your patience, please. :3 |
#2
|
|||
|
|||
Well my suggestion after looking at the levelup and reward function would be.
after the line Code:
$rewardstatus = reward($id, $type, $nextlevel, $owner); if true then get the promocode from the adopt. sql command: Code:
"SELECT * FROM ".$GLOBALS['prefix']."levels WHERE adoptiename='$type' and thisislevel='$nextlevel'" Code:
$promocode=@mysql_result($result, 0,"promocode"); <a href='promo.php?promocode=".$promocode."'>HERE IS A LINK TO PROMOCODE: $promocode</a> Code:
$article_content = "<img src='".$image."'><br>".$lang_gave."".$name." one ".$lang_unit.".<br>".$lang_levelup_encourage; Code:
$article_content = $article_content . "<div align='center'><br />You have earned ". grabanysetting('rewardmoney') ." ". grabanysetting('cost') ." for leveling up this adoptable. <br />You now have {$GLOBALS['money']} ".grabanysetting('cost')."</div>"; |
#3
|
|||
|
|||
Thank you so much, it works! ^___^
And it does display a link at all times, which is good, we want that. :3 But, unsurprisingly, the link is blank if the pet doesn't level, which is bad. Is there any way to make it always display the promocode? Edit: I moved the code down to the bottom, as part of the OUTPUT PAGE section. That got it to display the promocodes, and I even managed to make the link only display on "Happy Birthday" pages. :3 But I have one more wee problem. When I moved it, it stopped displaying the promocode for the current level, now its displaying the one for the next level. And changing $nextlevel to $currentlevel in the query has no affect. o_o What am I doing wrong? Last edited by xCataluna; 07-03-2011 at 02:09 AM. |
#4
|
|||
|
|||
Quote:
On line 165 or before "// Show a thank you message along with the adoptable's information to the user..." Check if it is the right type of adoptable then add in this query since we dont know if the pet leveled up or not and grab the $currentlevel sql: "SELECT * FROM ".$prefix."owned_adoptables WHERE aid='$id'"; get: $currentlevel then query to get the $promocode sql: "SELECT * FROM ".$prefix."levels WHERE adoptiename='$type' and thisislevel='$currentlevel'" get: $promocode then build the link and display it I would recomend at Code:
$article_content = $article_content . "<div align='center'><br />You have earned ". grabanysetting('rewardmoney') ." ". grabanysetting('cost') ." for leveling up this adoptable. <br />You now have {$GLOBALS['money']} ".grabanysetting('cost')."</div>"; Quote:
side note: bugs that I have notticed about leveling up, if you are logged out and click on the pet then log in you can click again but not the other way around. why is it showing you earned money when you are a visitor and not logged in? You could add a hook and suggest if you had been logged in/ sign up you could have earned that money. |
#5
|
|||
|
|||
Alright I've tried those queries, and it still uses the next promocode instead of the current one. I tried subtracting one from the $currentlevel before calling for the promocode, and that didn't work either. >.<
I wondered if it had something to do with the egg level having no promocode, so I added one to the database... no luck. :p Could it be some sort of problem associated with the egg level being zero, instead of one? I'm about ready to headdesk, but thank you for helping. X3 |
#6
|
|||
|
|||
echo out the sql queries and see what $currentlevel value is, maybe it is getting the wrong value somewhere.
|
#7
|
|||
|
|||
Alrighty~
I echoed $currentlevel and got a blank, which was weird. So I changed the query to reference $image instead, which echoed properly. But the displayed promocode was the same. >__< We decided to just work around the problem by shifting the promocode entries in mySQL one. So now the displayed promocode is correct. Not the most elegant solution, but it works now. :3 Thank you so much for all your help. <3 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help with levelup in 1.3.3? | Infernette | Questions and Supports | 1 | 03-25-2013 05:47 PM |
Levelup Problems? | Tequila | Questions and Supports | 4 | 11-18-2011 11:52 PM |
help with levelup.php please | Sensacionsk8 | Questions and Supports | 7 | 02-27-2011 01:44 PM |
help me with levelup.php | Sensacionsk8 | Questions and Supports | 0 | 02-23-2011 05:48 PM |
levelup issue | ipman | Questions and Supports | 8 | 01-26-2011 09:33 AM |
What's New? |
What's Hot? |
What's Popular? |