Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Addons/Mods Graveyard (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=41)
-   -   A quick Profile Add-on Modification (http://www.mysidiaadoptables.com/forum/showthread.php?t=820)

Bloodrun 05-14-2009 09:28 PM

A quick Profile Add-on Modification
 
Like the title says, a quick Profile Add-on Modification.
What does that mean?
I will show you how to make a new profile add-on, and make it work ;)

Profile Add-on Includes:
  • How to add a new option in your account.php file
  • How to make it so it shows up in your profile.php

Will Include:
  • A more advanced looking account.php
  • A friends option
  • A 'customize' your own profile option.

Preview:]
(Image is too large for page.)
http://i43.tinypic.com/2s6sm5e.jpg

First things first, whatever you want to add to your profile/account file, you MUST add to your database, and to do that, all you need to do, is come up with a name, and place into your 'adopts_user' table.
For the sake of this tutorial, I will be showing you how to add a very simple 'about me' section to your profile.

So go ahead and add this to your 'adopts_user' table:

Code:

  `aboutme` varchar(5000) NOT NULL,
Next, go to your account.php file, and find where it says:

PHP Code:


// 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) { 

And place the following two things, in the appropriate groups:

PHP Code:

$aboutme=@mysql_result($result,$i,"ame"); 

PHP Code:

$ame stripslashes($ame); 

Then scroll down, to where it says:

PHP Code:

// 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."<br><br><br><br><br>

<form name='form1' method='post' action='accountpost.php'> 

And insert the following any where in that form:

PHP Code:

  <p>About Me: <br>
    <
textarea name='aboutme' type='text' id='aboutme' cols='40' rows='3'>".$ame."</textarea>
</
p

Now that's it for the account.php file.

Now go to your accountpost.php file, and find where it says:

PHP Code:

else if($act == "changesettings"){

// We are changing the settings

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

And place the following in that group:

PHP Code:

$aboutme $_POST["aboutme"];
$aboutme secure($aboutme); 

Then scroll down to where it says:

PHP Code:

// Run update queries...

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

And place the following in that group:

PHP Code:

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

Now before we do ANYTHING else, go to your register.php file, and find where it says:

PHP Code:


        mysql_query
("INSERT INTO ".$prefix."users VALUES ('', '$username', '$pass1', '$email', '3', '1', '$date', '0')"); 

And add this to the end:

Note: it is not a quotation mark, it is a double tick ' and '
PHP Code:

'' 

So it looks like this:

PHP Code:


        mysql_query
("INSERT INTO ".$prefix."users VALUES ('', '$username', '$pass1', '$email', '3', '1', '$date', '0', '')"); 

Now, to make this all show up on your profile page ;D

Go to your profile.php and find where it says:

PHP Code:

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) { 

And place the following in a that group:

PHP Code:

    $aboutme=@mysql_result($result,$i,"aboutme"); 

Now you can add the part where if a user hasn't entered anything in for the category, it will say something like "No information given" but, I'm going to show it.

Next scroll down to where it says:

PHP Code:

    // Show the user's profile page... 

And place the following within the '$article_content':

PHP Code:

<b>About Me:</b><br".$aboutme."<br

And your down. Don't be afraid to ask questions. I won't bite. =D

rainbelly 05-15-2009 07:20 AM

RE: A quick Profile Add-on Modification
 
Cool!

However, I am getting an error on the MySQL:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`aboutme` VARCHAR(5000) NOT NULL,' at line 2

SJC 05-15-2009 02:21 PM

RE: A quick Profile Add-on Modification
 
Quick question. Do you have to add another ,'' at the end of :
mysql_query("INSERT INTO ".$prefix."users VALUES ('', '$username', '$pass1', '$email', '3', '1', '$date', '0', '')");
if you wanted to insert another profile field?

Bloodrun 05-15-2009 03:01 PM

RE: A quick Profile Add-on Modification
 
Quote:

Originally Posted by rainbelly
Cool!

However, I am getting an error on the MySQL:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`aboutme` VARCHAR(5000) NOT NULL,' at line 2

That has to do with how you put it in your database. Each new line has to end with a comma.

Quote:

Originally Posted by SJC
Quick question. Do you have to add another ,'' at the end of :
mysql_query("INSERT INTO ".$prefix."users VALUES ('', '$username', '$pass1', '$email', '3', '1', '$date', '0', '')");
if you wanted to insert another profile field?

Yes you do, lol don't forget that. It will frustrate you beyond belief. ;)

SJC 05-15-2009 03:07 PM

RE: A quick Profile Add-on Modification
 
Okay, just wanted to make sure :).

Bloodrun 05-15-2009 03:08 PM

RE: A quick Profile Add-on Modification
 
Quote:

Originally Posted by SJC
Okay, just wanted to make sure :).

Lol okie dokie.
Oh, if you have any suggestions for new modifications, or want something made for your site. Just drop me a PM =D

mapleblade 05-16-2009 07:05 AM

RE: A quick Profile Add-on Modification
 
it works fine, but if i add something it only sais on profile "about me:"
after that nothing.

Bloodrun 05-16-2009 02:28 PM

RE: A quick Profile Add-on Modification
 
Quote:

Originally Posted by mapleblade
it works fine, but if i add something it only sais on profile "about me:"
after that nothing.

Then it has to do with how your calling it on your profile page.
First check to make sure its even going into the database.

12345 05-22-2009 07:55 AM

RE: A quick Profile Add-on Modification
 
I have do everything in instructions but profile is not looking like this
http://i43.tinypic.com/2s6sm5e.jpg
And I already have this:
`aboutme` varchar(5000) NOT NULL,
from your other mod

Bloodrun 05-22-2009 08:16 AM

RE: A quick Profile Add-on Modification
 
Quote:

Originally Posted by 12345
I have do everything in instructions but profile is not looking like this
http://i43.tinypic.com/2s6sm5e.jpg
And I already have this:
`aboutme` varchar(5000) NOT NULL,
from your other mod

Are you sure you added the .html file for the users profile?
Because without that, the profile will not look like its suppose to.


All times are GMT -5. The time now is 08:21 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.