Choosing Adoptables Type [EASY ADOPTABLES SCRIPT ONLY]

Forum
Last Post
Threads / Messages

Ashje

Member
Member
Joined
Jan 17, 2009
Messages
179
Points
0
Mysidian Dollar
6,799
Ok, so I don't think I've made a mod before, only tuts. But anyway if you noticed the tag "EASY ADOPTABLES SCRIPT ONLY", this mod is only for the old script. This is for the people with current sites using the old script, just while we're waiting for the upgrade script. Now, onto what it does... If you've ever used the currency & shop mod or tried to make an event, you'll know that you have to run a MySQL query to change it's type so it doesn't appear on the normal adopt.php page and only in the shop/event. With this mod, you'll be able to do it easily from the "Create New Adoptable" page in the ACP. This makes it easy to make new shop adoptables or event adoptables. Before we start, I suggest you make backups of the following:
adopt.php
shop.php
newadoptable.php (found in your adm directory)
makeadoptable.php (found in your adm directory)
Ready?

Step 1
-------------
First, open your phpMyAdmin and go to the adoptables table. Notice how I have a "Kind" column? You need to make one.

1-1.jpg


Step 2
-------------
To make one, click the following:
2-1.jpg

3-1.jpg

Now fill it in like this one:
4-1.jpg


Step 3
-------------
Now that you have a Kind column, open your FTP Server and open up "adopt.php" in your editor. Find:
PHP:
$query = "SELECT * FROM adoptables";
and change it to:
PHP:
$query = "SELECT * FROM adoptables WHERE kind = 'normal'";
Save it.

Step 4
-------------
If you use the shop mod, open up "shop.php" in the editor. Find:
PHP:
$query = "SELECT * FROM adoptables WHERE memberlevel = 'shop'";
Change to:
PHP:
$query = "SELECT * FROM adoptables WHERE kind = 'shop'";

Save it.

Step 5
-------------
Now go into your adm directory and open up "newadoptable.php"
Find:
PHP:
    <p>Adoptable Description: 
      <input name='description' type='text' id='description'> 
    </p>
Underneath that, place:
<p>Adoptable Kind:
<input name='kind' type='text' id='kind'>
</p>
PHP:

Save it.

Step 6
-------------
Go back to the adm directory and open "makeadoptable.php". Find:
PHP:
$description = $_POST["description"];
Underneath that, place:
PHP:
$kind = $_POST["kind"];

Then Find:
PHP:
$description = mysql_real_escape_string($description);
Underneath that, place:
PHP:
$kind = mysql_real_escape_string($kind);

Then find:
PHP:
if($level0 == ""){
echo "You did not choose a default image for your adoptable.  Please go back and correct this.";
die("");
}
Underneath, place:
PHP:
if($kind == ""){
echo "You did not choose a kind for your adoptable.  Please go back and correct this.";
die("");
}
Finally find:
PHP:
mysql_query("INSERT INTO adoptables VALUES ('', '$name','$level0','free','$description')");
Replace with:
PHP:
mysql_query("INSERT INTO adoptables VALUES ('', '$name','$level0','free','$description','$kind')");

Now, you should get something like this when you go to make a new adoptable. Type "shop" in the Adoptable kind box for it to be a shop adoptable, and type "normal" for it to be a normal one.


NOTE: For the anti-theft, you still have to change the memberlevel to shop, although you can make a memberlevel type field as well by replacing every "kind" in this tut with "memberlevel" with the exception of "adopt.php". Also, there is already a memberlevel column so don't make another one.

I know this mod is probably very confusing so if you have any questions, ask.
 
Very nice, when I get my laptop back, ill take a better look at it.

And, well, Ill say nothing more till I get my laptop back =D
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,118
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top