Tip:
Highlight text to annotate it
X
Hi! My name is Peter. Welcome to my first tutorial.
I´ll show you how to edit Joomla core.
I have some sites running on Joomla 2.5 and I didn´t like standard registration form. So I wanted to change it. I didn´t found any explanation, so I helped on my own.
In standard form I didn´t like that you must put full name and I wanted to make a surname field.
At first we need PSPad editor for edit next few files.
It´s freeware so you can download it.
So whole Joomla is built on sql database
It means that every variable is written and read to set of tables in sql. So open your sql database (my provider uses phpMyAdmin).
At home site click on your database. We will edit user so find users table
In search field and click on it (maybe before _users you have something else, it doesnt matter).
(I had some old users there so I deleted him).
Click on structure tab and add 1 field after field name, so we are adding new field on 3rd position.
Name will be surname, all variables are same as name field (its very similar).
Ok you have surname field now, its empty because joomla doesnt know about it yet.
So we need to edit libraries/joomla/user/user.php (in this file is set of variables that joomla uses againts database).
For continue its important to say that Joomla is separated to front-end(FE) and back-end (BE).
FE is what common user can see. So this is front end, set of components, modules and so on.
BE is classic administration view.
This is file system of your pages on server.
There I created mirrorfolders with edit files, I recommend to make backup of these files (just for sure :-).
Ok,so open libraries/joomla/user/user.php. Copy/paste $name variable and change it to $surname,save it and copy to server.
No big changes now.
Next open FE file components/com_users/models/form/registration.xml Its content of registration form (not view, it makes another file)
Copy/paste field name We copy this field and paste it under, change name to surname
Im editing labels for this fields, required=true means that field will be required, save it and copy to server
OK we have a new field now. For correct showing of labels open language file in language/en-GB/en-GB.com_users.ini
For some order, put the new label surname after name labels Save and copy to server
(bla bla bla) (I made small mistake sorry :-)
There it is
Jop we have it
So you can try it now. Make a new user and you can see now new user with surname in php table
Problem is that you want to see it also in BE, so lets do it.
I skip this file (its for common parts like register button label and so on)
So open administrator/components/com_users/models/forms/user.xml
Its similar file to registration.xml, but you edit BE now.
Copy name field again and change it to surname, save it and copy to server.
Now in user profile you can see new field, but also we need to have it in this table.
Open administrator/components/com_users/views/users/tmpl/default.php Its little bit complex code now, bur quiet readable.
This th marks are this upper labes (only) of the column
So we need to add new column label surname
Copy th with name, paste under, change order (its not left but nowrap
like the others - make fun with nowrap) and change to surname. Save it and copy to server.
OK lets see it. Ok we have now column label, but there is problem with cells under.
There are missing cells so whole table is now more left. Lets deal with it.
These cells is defined in the same file default little bit bellow, they have td marks
Copy this long td (its again for name) and change it to surname. Save it and copy to server
OK now you can see surname of test user, so it communicates with database now.
Last change is editing of admin language so open administrator/language/en-GB/en-GB.com_users.ini
So again for some order put labels under name rows
Save it and copy to server
We finish now, write comments if you want to know something.
Next tutorial will be about adding some checkboxes (for newsletters or rules).
I hope that this video helps you, Enjoy and bye