
This is one of the most sought after tutorials, yet it has never been created. I get this question constantly. How do I add my own field to the your account module? Well, here is your answer :)
Steps :
Before getting started, I must say this. PLEASE DO NOT BE AFRAID OF YOUR DATABASE. With that said, let's get started.
Make a list of the new fields you need added. It may be good to note that not every field in mysql are the same, some are for numbers, others for text and so on. I will show you how to add one text and one number field. In this tutorial, I want to add a Cool Name field and a Age field.
We need to add these to Mysql using phpmyadmin. In most cases your host gives you access to that. These fields will be added to your nuke_users table so go ahead and click on that. Scroll close to the bottom to where you see the add fields option (fig.1)
Fig.1![]()
We need to add 2 fields so place two inside the Add fields box. We also want the new fields to be placed at the bottom of the table so leave it checked at At End of Table then press Go. You should now see the following fields(Fig.2) asking you to enter some more details.
Fig.2
![]()
The two fields I added are:
user_coolname VARCHAR 255(this is a text field to hold Cool Names)
user_memb_age INT 10 null NULL (this will keep our age and will not add a "0" as default. We need it to be blank so we use NULL)
Click Save to add our new fields to the database. Congrats! You are done with the database.
We now need to make the modifications to the Your Account module to add the new fields. Open modules/Your_Account/index.php .I will be adding my two new fields just above the YOUR ICQ field(Fig.3).
Fig.3

Search for the following codes inside the function edituser()
Let's add our Cool Name field first. Just above that code paste the following.
The fields of interest are:
_COOLNAME <-- This is the actual name that will be shown beside the field box. This will be defined in the language file.
name=\"user_cname\"<-- Each field name has to be unique so i added user_cname which is not already inside the file.
value=\"$userinfo[user_coolname]\" <-- This is listing the name of the field in the database for cool name. Remember we added this field to the database?
Repeat that last step to add the Age field. This time you will change the fields above to be different. Your codes should look similar to the following.
We need to now add the two variables $user_cname and $user_cage both variables are taken from the name of each text field. When you send them in the form we can gather the data by user the name as a variable.
Once the form is submitted we need to add the variables to the database so search for the following: function saveuser. You will notice that there are alot of variables within the brackets. We need to add ours to the end.
Notice how I added my two new variables at the end. We now need to check our inputs to make sure they are safe before entering into the database. Inside that same function, find the following codes
$realname = check_html($realname, nohtml);
Under that do our checks like the following.
Time to add the variables to the database. Scroll down and find our first query and add our two variables like the following.
Scroll down a few more lines to see another query similar to the one we just edited and make the same changes..
Scroll to the bottom of the page and look for and add the variables there like the following.
Last thing to do now is add your language definitons that we added to the file. _COOLNAME and _COOLAGE. Open modules/Your_Account/language/lang-english.php and add the following codes to the bottom of the file just before ?>
That's it! Enjoy the fruits of your labour :)

Marketplace Themes, scripts, icons and images
Themes site PHP Nuke themes preview site.
234
13,482