Profile Add-Ons :3

Forum
Last Post
Threads / Messages

PTGigi

Crazily Friendly~HoF
Premium Member
Joined
Jul 17, 2009
Messages
363
Points
0
Age
29
Location
Somewhere >.>
Mysidian Dollar
15,125
Right! So I made a useful script! It's just a few minor profile add-ons :meow: Stuff like:
-Your Gender (dur) :madnoes:
-Your Nickname (helpful!)
-Your Favorite Color (RAINBOW *shot*)
-A bio! YAY!
-Your favorite adoptable! :colonu:
-A small bio for your favorite adoptable! :veeee:

So now to get this stuff installed we start by adding in the tables!

Go to the user table and add in these at the bottom:
profile varchar(500) utf8_general_ci Null
color varchar(20) utf8_general_ci Null
about varchar(200) utf8_general_ci Null
favpet int(11) Null
gender varchar(10) utf8_general_ci not null Unknown (<--that's the 'not null' part :3)
nickname varchar(40) utf8_general_ci Null

Now we go to opening up the 'register.php' (do that now *sits and waits* done? Okay!)

Now go down and find something like this:
PHP:
    else if($emailisvalid != "yes"){

    //Email address is not valid or is a fake

    $article_title = "Email address is not valid";
    $article_content = $emailinvalid;

    }
    else{

    //All checks are done, actually create the user's account on the database

    $date = date('Y-m-d');

    mysql_query("INSERT INTO ".$prefix."users VALUES ('', '$username', '$pass1','$email', '500', '50', '100', '200', '100', '5', '3','1', '$date', '0','','','','','', '0', '', '', '', '', '', 'Unknown', '')");

    //Now that we have created the user, let's log them in...
Now see that whole mysql_query? DO NOT PASTE. That's mine, I have 6 cash types, you probably don't >.> You should add in:
Code:
, '', '', '', '', 'Unknown', ''
after your last entry but before the )");

All good? Okay! Now that just made it so people can register properly. We don't want that messed up D:

Now we should edit this information, why show it when we can't edit it? Now open up your Account.php

Go fine (yours will be different!):
PHP:
if($act == ""){

// No action specified

$article_title = $loggedinname."'s Computer";
$article_content = "BZZT...Welcome! <br>Checking name and password...checking...checking...<br>Name and password verfied. Welcome ".$loggedinname."<br>
Choose one of the options below to manage your account. You can change settings that involve your <a href='/myadopts.php'>Pokemon</a>, your <a href='profile.php?user=".$loggedinname."'>Profile</a> page, and your account via this system.<br><br>
<b><u>Options:</u></b><br><br>
<a href='myadopts.php'>Manage your Pokemon</a><br>
<a href='profile.php?user=".$loggedinname."'>View Profile</a><br>
<a href='account.php?act=changeemail'>Change Email Address</a><br>
<a href='account.php?act=changepass'>Change Password</a><br>
<a href='account.php?act=changesettings'>Change Settings and Profile Info</a><br>
<a href='account.php?act=moreprofile'>More Profile Settings</a>";

}
See the last one, "More Profile Settings"? You'll need that link in there, so add this after Change Settings:
Code:
<br>
<a href='account.php?act=moreprofile'>More Profile Settings</a>
MAKE SURE YOU BUT THIS BEFORE THE ";

Now scroll down and find this:
PHP:
else if($act == "changesettings"){

// We are changing the settings

$article_title = $lang_changesettings_title;
$article_content = $lang_changesettings."<br>";

// Get the user's account details from the database...

$query = "SELECT * FROM ".$prefix."users WHERE username='$loggedinname'";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

$newmessagenotify=@mysql_result($result,$i,"newmessagenotify"); 
$website=@mysql_result($result,$i,"website");
$aim=@mysql_result($result,$i,"aim");
$yahoo=@mysql_result($result,$i,"yahoo");
$msn=@mysql_result($result,$i,"msn");

$website = stripslashes($website);
$aim = stripslashes($aim);
$yahoo = stripslashes($yahoo);
$msn = stripslashes($msn);


$i++;
}

// Show the form...

if($newmessagenotify == 1){
$box = "<input name='newmsgnotify' type='checkbox' id='newmsgnotify' value='1' checked>";
}
else{
$box = "<input name='newmsgnotify' type='checkbox' id='newmsgnotify' value='1'>";
}

$article_content = $article_content."<form name='form1' method='post' action='accountpost.php'>
  <p>".$box."
  Notify me via email when I receive a new message or reward code</p>
  <p><u>Publically Viewable Details: </u></p>
  <p>Website: 
    <input name='website' type='text' id='website' value='".$website."'>
</p>
  <p>AIM Username: 
    <input name='aim' type='text' id='aim' value='".$aim."'>
</p>
  <p>YIM Username: 
    <input name='yim' type='text' id='yim' value='".$yahoo."'>
</p>
  <p>MSN Username: 
    <input name='msn' type='text' id='msn' value='".$msn."'>
    <input name='act' type='hidden' id='act' value='changesettings'>
</p>
  <p>
    <input type='submit' name='Submit' value='Submit Details'>
  </p>
</form>";



}
Now directly after that paste this in:
PHP:
else if($act == "moreprofile"){
// We are changing the settings

$article_title = "Editing Profile Setting";
$article_content = "This page will allow you to change extra features of your profile page. These features are not mandatory but will add an extra dimension to your public profile page.<br>";

// Get the user's account details from the database...

$query = "SELECT * FROM ".$prefix."users WHERE username='$loggedinname'";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

$profile=@mysql_result($result,$i,"profile"); //user bio
$color=@mysql_result($result,$i,"color");
$about=@mysql_result($result,$i,"about"); //about the fav pet
$favpet=@mysql_result($result,$i,"favpet");
$gender=@mysql_result($result,$i,"gender");
$nickname=@mysql_result($result,$i,"nickname");

$i++;
}

// Show the form...
if ($gender == "Male"){
$gen="<input type='radio' name='gender' value='Unknown'>Unknown/Hidden<br>
    <input type='radio' name='gender' value='Male' checked> Male<br>
<input type='radio' name='gender' value='Female'> Female";
}
else if ($gender == "Female"){
$gen="<input type='radio' name='gender' value='Unknown'>Unknown/Hidden<br>
    <input type='radio' name='gender' value='Male'> Male<br>
<input type='radio' name='gender' value='Female' checked> Female";
}
else {
$gen="<input type='radio' name='gender' value='Unknown' checked>Unknown/Hidden<br>
    <input type='radio' name='gender' value='Male'> Male<br>
<input type='radio' name='gender' value='Female'> Female";
}


$article_content = $article_content."<form name='form1' method='post' action='accountpost.php'>
  <p><u>Profile Details: </u></p>
<p>Nickname:     <input name='nickname' type='text' id='nickname' value='".$nickname."'></p>
    <p>Gender:<br>
".$gen."</p>
<p>Favorite Color:    <input name='color' type='text' id='color' value='".$color."'> (please, colors only)</p>
  <p>Your Bio: 
    <textarea name='profile' cols='45' rows='4' id='profile'>".$profile."</textarea>Here is a bio for yourself, the maximum number of characters you can use is 500. You can write whatever you want but abide by the </a href='tos.php'>ToS</a> and do NOT post content that involves an advertisement, vulgar language, or any other acts that could get your account banned. BBC is NOT useable for this. Feel free to tell the world whatever you want about yourself!</p>

  <p><u>Pet Spotlight Details: </u></p>
  <p>Favorite Pet ID: 

    <select name='favpet' id='favpet'>
      <option value='' selected>No Pokemon Selected</option>";
      
// We need to stop here and fetch our adoptables...

    $query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner = '".$loggedinname."' ";
    $result = mysql_query($query);
    $num = mysql_numrows($result);

    //Loop out code
    $i=0;
    while ($i < $num) {

    $aid=@mysql_result($result,$i,"aid");
    $name=@mysql_result($result,$i,"name");
    
    $article_content = $article_content."<option value='".$aid."'>".$name."</option>";    

    $i++;
    }

      
   $article_content = $article_content."</select>
</p>
  <p>Favorite Pet Bio: 
    <textarea name='about' cols='45' rows='4' id='about'>".$about."</textarea>Here is a bio for your pet, the maximum number of characters you can use is 200. You can write whatever you want but abide by the </a href='tos.php'>ToS</a> and do NOT post content that involves an advertisement, vulgar language, or any other acts that could get your account banned. BBC is NOT useable for this.
</p>
    <input name='act' type='hidden' id='act' value='moreprofile'>
</p>
  <p>
    <input type='submit' name='Submit' value='Submit Details'>
  </p>
</form>";

}
This will let you change your profile page. But wait! You're not done!

Now go open up accountpost.php, we need to actually have this work!
Go find:
PHP:
else if($act == "changesettings"){

// We are changing the settings

$newmsgnotify = $_POST["newmsgnotify"];
$newmsgnotify = preg_replace("/[^a-zA-Z0-9@._-]/", "", $newmsgnotify);
$newmsgnotify = secure($newmsgnotify);

$website = $_POST["website"];
$website = secure($website);

$aim = $_POST["aim"];
$aim = secure($aim);

$yim = $_POST["yim"];
$yim = secure($yim);

$msn = $_POST["msn"];
$msn = secure($msn);

if($newmsgnotify != 1){
$newmsgnotify = 0;
}

// Run update queries...

$query = "UPDATE ".$prefix."users SET newmessagenotify='".$newmsgnotify."' WHERE username='".$loggedinname."'";
mysql_query($query);

$query = "UPDATE ".$prefix."users SET website='".$website."' WHERE username='".$loggedinname."'";
mysql_query($query);

$query = "UPDATE ".$prefix."users SET aim='".$aim."' WHERE username='".$loggedinname."'";
mysql_query($query);

$query = "UPDATE ".$prefix."users SET yahoo='".$yim."' WHERE username='".$loggedinname."'";
mysql_query($query);

$query = "UPDATE ".$prefix."users SET msn='".$msn."' WHERE username='".$loggedinname."'";
mysql_query($query);

// All done!

$article_title = $lang_changedsuccess_title;
$article_content = $lang_changedsuccess;
}
And directly after it add:
PHP:
else if($act == "moreprofile"){

// We are changing the settings

$nickname = $_POST["nickname"];
$nickname = secure($nickname);

$gender = $_POST["gender"];
$gender = secure($gender);

$color = $_POST["color"];
$color = secure($color);

$profile = $_POST["profile"];
$profile = secure($profile);

$favpet = $_POST["favpet"];
$favpet = secure($favpet);

$about = $_POST["about"];
$about = secure($about);

// Run update queries...

$query = "UPDATE ".$prefix."users SET nickname='".$nickname."' WHERE username='".$loggedinname."'";
mysql_query($query);

$query = "UPDATE ".$prefix."users SET gender='".$gender."' WHERE username='".$loggedinname."'";
mysql_query($query);

$query = "UPDATE ".$prefix."users SET color='".$color."' WHERE username='".$loggedinname."'";
mysql_query($query);

$query = "UPDATE ".$prefix."users SET profile='".$profile."' WHERE username='".$loggedinname."'";
mysql_query($query);

$query = "UPDATE ".$prefix."users SET favpet='".$favpet."' WHERE username='".$loggedinname."'";
mysql_query($query);

$query = "UPDATE ".$prefix."users SET about='".$about."' WHERE username='".$loggedinname."'";
mysql_query($query);

// All done!

$article_title = $lang_changedsuccess_title;
$article_content = $lang_changedsuccess;
}
And now everything should edit properly! One last thing we need to do is display this information publicly! So now go open profile.php (the last step!)

Go find something like this:
PHP:
if($user != ""){

// We have specified a specific user who we are showing a profile for...
// See if the user exists...

    $query = "SELECT * FROM ".$prefix."users WHERE username = '".$user."'";
    $result = mysql_query($query);
    $num = mysql_numrows($result);

    if($num > 0){

    $i=0;
    while ($i < 1) {

    $usersname=@mysql_result($result,$i,"username");
    $usersgroup=@mysql_result($result,$i,"usergroup");
    $website=@mysql_result($result,$i,"website");
    $aim=@mysql_result($result,$i,"aim");
    $yahoo=@mysql_result($result,$i,"yahoo");
    $msn=@mysql_result($result,$i,"msn");
    $membersince=@mysql_result($result,$i,"membersince");
Now directly after this add in:
PHP:
    $bio=@mysql_result($result,$i,"profile");
    $favcolor=@mysql_result($result,$i,"color");
    $aboutfavpet=@mysql_result($result,$i,"about");
    $favpetID=@mysql_result($result,$i,"favpet");
    $gender=@mysql_result($result,$i,"gender");
    $nickname=@mysql_result($result,$i,"nickname");

    if ($favpetID == ""){
        $favpet = "None Selected";
    }
    else {
    $favpet="<a href='/levelup.php?id=".$favpetID."' target='_blank'>
<img src='/siggy.php?id=".$favpetID."' border=0></a>";
    }
    
    if ($aboutfavpet == "" and $favpetID != ""){
        $about = "Click me! I'm hungry!";
    }
    else if ($aboutfavpet == "" and $favpetID == ""){
        $about = "No Pet Selected";
    }
    else {
        $about = $aboutfavpet;
    }
All done with that? Now you can arrange this however you see fit but somewhere in here:
PHP:
    <img src='templates/icons/web.gif'> ".$website."<br>
    <img src='templates/icons/aim.gif'> ".$aim."<br>
    <img src='templates/icons/msn.gif'> ".$msn."<br>
    <img src='templates/icons/yahoo.gif'> ".$yahoo."<br><br>
    <img src='templates/icons/title.gif'> <a href='messages.php?act=newpm&user=".$usersname."'>Send ".$usersname." a Private Message</a><br><br><hr>
    <br><b><u>".$usersname."'s Site Stats:</b></u><br><br>
    <b>Member Since:</b> ".$membersince."<br>
    <b>Pokemon Owned:</b> ".$numpets."<br>
    <b>Rank:</b> Ranks coming soon!<br><br>
You need to add in:
PHP:
    Gender: ".$gender."<br>
    Favorite Color: ".$favcolor."<br>
    Nickname: ".$nickname."<br>
    Bio: <br>
    ".$bio."<br>
    <hr><br>
    <h2>.:PokeSpotlight:.</h2><br>
    ".$favpet."<br>".$about."<br>
Change the text obviously since PokeSpotlight and Pokemon Owned is probably not for your site X3 It's better to arrange this with HTML Tables, but I suck at those and don't want to bother with explaining that X3 But my site is set up with the info on the left and the Pet info on the right. Arrange how you like.

Now I think (hope) that's it! Have fun with your new features! :3
 
Last edited:
Lovely, thank you for posting this Gigi. ^^ I am sure lots of users will find it useful, I will probably include this in Mys version 1.20 if you dont mind.
 
Orly? That'd be awesome :BIGO: I didn't think I'd make anything script worthy to throw into the main release :meow: Thank you! :veeee:
 
Well I will consider this, you will definitely be credited if it happens. It is the entire dev staff team's decision on what scripts to add into next release though. ^^
 
Of course! :veeee: If you guys randomly decide yes I'm happy to let it be in future releases :meow:

Now that makes me want to finish my avatar and points codes X3 (not a picture avatar like on here, sort like a human avatar for yourself that you can edit and such with different clothing, etc :happycbig: and the points thing is like...*thinks of example* like those points in Pokemon Mystery Dungeon where you get stuff if you level-up but it can never go down :happyfaic:)
 
Alright, I will let you know then Gigi.

Actually I was thinking about the idea of trainer class, in which you can make yourself a specific type of trainer such as firebreather, swimmer, shocker, flowergirl in Pokemon series. The adoptables can have various elements too, and different trainer classes specialize different elements of adoptables. In Pokemon, for instance, a firebreather's fire type pokemon grows faster and stronger, while his water type pokemon does not have the same luck. It is pretty much like a job system for MMORPGs. XD
 
Alright, I will let you know then Gigi.

Actually I was thinking about the idea of trainer class, in which you can make yourself a specific type of trainer such as firebreather, swimmer, shocker, flowergirl in Pokemon series. The adoptables can have various elements too, and different trainer classes specialize different elements of adoptables. In Pokemon, for instance, a firebreather's fire type pokemon grows faster and stronger, while his water type pokemon does not have the same luck. It is pretty much like a job system for MMORPGs. XD

That would be awesome if Gigi made that. XD Though I could see it being abused if you could just change it whenever you want because you can just keep on changing it whenever you get a different type of pokemon and raise them quicker/whatever other benefits occur with these trainer classes. Would it be like they could chose it when they register and maybe if they really want to change it you could buy a change in trainer class?

Nice codes Gigi BTW. I tried it out on mm2 and it was cool.
 
Oh that's cool! :BIGO: I came up with mine because...well IDK I just randomly thought of it, drew a human sketch, failed at the legs for an hour or so and finally decided the peeps will be Saytaurs but rather than goats they'll be Pokemon. And depending on your rank (the points) you get different add-ons and such. And maybe some random special effect for Pokemon of the same species as your choice :meow: I haz very random ideas. And it was going to be Flash based for animation, plus I want to learn how to combine Flash and PHP because I know you can :madnoes: But that'll be awhile

Derp, and since I just thought of this, if people want an idea of how to set things up (since I said I wasn't going to bother to explain tables X3) here's a sample of how it might look:
http://mm2plus.com/profile.php?user=Pokemontrainergigi
(peeps please don't join until I open the site X3 Only those who get my okay can join beforehand and will do beta tester stuff when I get some locations and features for you to test :meow:)


EDIT: CHRIS YOU NINJA D:< Naw jk :p Lol yus your profile is nice X3 Thanks :3
 
That would be awesome if Gigi made that. XD Though I could see it being abused if you could just change it whenever you want because you can just keep on changing it whenever you get a different type of pokemon and raise them quicker/whatever other benefits occur with these trainer classes. Would it be like they could chose it when they register and maybe if they really want to change it you could buy a change in trainer class?

Nice codes Gigi BTW. I tried it out on mm2 and it was cool.

Well this is definitely a potential flaw, maybe we will set certain restrictions to that. For instance, users can change their trainer types like only 2-3 times in a month.

Anyway this is Gigi's profile addon thread, so we better leave this discussion elsewhere. Again nice job on it Gigi!
 
Guys a change was made so if you're using this please add in this new edit :happycbig: It's not much, just a drop-down menu that allows the user to use ONLY their own adoptables.

The "Pet Spotlight Details" and replace entirely with this:
PHP:
  <p><u>Pet Spotlight Details: </u></p>
  <p>Favorite Pet ID: 

    <select name='favpet' id='favpet'>
      <option value='' selected>No Pokemon Selected</option>";
      
// We need to stop here and fetch our adoptables...

    $query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner = '".$loggedinname."' ";
    $result = mysql_query($query);
    $num = mysql_numrows($result);

    //Loop out code
    $i=0;
    while ($i < $num) {

    $aid=@mysql_result($result,$i,"aid");
    $name=@mysql_result($result,$i,"name");
    
    $article_content = $article_content."<option value='".$aid."'>".$name."</option>";    

    $i++;
    }

      
   $article_content = $article_content."</select>
</p>
  <p>Favorite Pet Bio: 
    <textarea name='about' cols='45' rows='4' id='about'>".$about."</textarea>Here is a bio for your pet, the maximum number of characters you can use is 200. You can write whatever you want but abide by the </a href='tos.php'>ToS</a> and do NOT post content that involves an advertisement, vulgar language, or any other acts that could get your account banned. BBC is NOT useable for this.
</p>
    <input name='act' type='hidden' id='act' value='moreprofile'>
</p>
  <p>
    <input type='submit' name='Submit' value='Submit Details'>
  </p>
</form>";
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,267
Messages
33,049
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top