The example in this article describes how joomla implements adding new fields for registered users. Share it with everyone for your reference, the details are as follows:
Joomla’s original registration was very simple, in order to add the fields you want, such as phone number.
Add this field "telphone" in the database
Modify librariesjoomladatabasetableuser.php
Add new variables in the JTableUser class:
var $telphone = null;
Modification of the page
Modify componentscom_userviewsregistertmpldefault.php
Add the input field here, The name must be the same as the field defined in your database
Copy the code The code is as follows:
It is not good to directly modify the source code, so it is recommended to change the component The page code can be modified in your own templates folder, minimizing modifications to the source code.
Finally, I don’t want to send emails to users. Newly registered users can only take effect after being reviewed by the backend administrator. Comment the following code componentscom_usercontroller.php:
//UserController::_sendMail($user, $password);
Readers who are interested in more joomla related content can check this Site topics: "Introduction to Symfony Framework Tutorial", "Introduction to Yii Framework and Summary of Common Techniques", "Summary of Excellent PHP Development Framework", "Basic Tutorial for Getting Started with Smarty Templates", "Summary of Common Methods in ThinkPHP", "Introduction to PHP Object-Oriented Programming" Tutorial", "php string (string) usage summary", "php+mysql database operation introductory tutorial" and "php common database operation skills summary"
I hope this article will be helpful to everyone based on joomla programming.
The above introduces the method of adding new fields for registered users in joomla, including the content of joomla. I hope it will be helpful to friends who are interested in PHP tutorials.