Add fields to Joomla! registration form
- rsdebasis
- Joomla! Apprentice
- Posts: 8
- Joined: Sat Jan 29, 2011 9:46 am
Add fields to Joomla! registration form
There are many steps
step1:-Add DB field variable to user.php
open file as below:
YOUR_SITE/libraries/joomla/database/table/user.php
/**
* The phone
*
* @var string
*/
var $phone = null;
Step 2. Add field in the DB
ALTER TABLE `jos_users` ADD `phone` int NOT NULL AFTER `username`;
Step 3. Edit Default.php template file for user to add extra field details during registration
open file as below:
YOUR_SITE/components/com_user/views/register/tmpl/default.php
<tr>
<td height="40">
<label id="phonemsg" for="phone">
<?php echo JText::_( 'Phone' ); ?>:
</label>
</td>
<td>
<input class="inputbox required validate-phone" type="text" id="phone" name="phone" size="40" value="" /> *
</td>
</tr>
Step 4. Edit form.php template file for user to edit profile with extra field
open below file:
YOUR_SITE/components/com_user/views/user/tmpl/form.php
<tr>
<td>
<label for="phone">
<?php echo JText::_( 'phone' ); ?>:
</label>
</td>
<td>
<input class="inputbox validate-phone" type="text" id="phone" name="phone" size="40" />
</td>
</tr>
Step 5. Edit default.php to add extended registration columns in the table view
open below file:
YOUR_SITE/administrator/components/com_users/views/users/tmpl/default.php
//table heading
<th width="15%" class="title">
<?php echo JHTML::_('grid.sort', 'phone', 'a.phone', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
</th>
//display data
<td>
<?php echo $row->phone; ?></a>
</td>
Step 6. Edit form.php template file for user to edit profile with extra field to handle user creation or edit by admin
open below file:
YOUR_SITE/administrator/components/com_users/views/user/tmpl/form.php
<tr>
<td class="key">
<label for="phone">
<?php echo JText::_( 'phone' ); ?>
</label>
</td>
<td>
<?php if(!$this->user->get('phone')) : ?>
<input class="inputbox disabled" type="text" name="phone" id="phone" size="40" value="" disabled="disabled" />
<?php else : ?>
<input class="inputbox" type="text" name="phone" id="phone" size="40" value=""/>
<?php endif; ?>
</td>
</tr>
Thats it. Enjoy. Best of luck
step1:-Add DB field variable to user.php
open file as below:
YOUR_SITE/libraries/joomla/database/table/user.php
/**
* The phone
*
* @var string
*/
var $phone = null;
Step 2. Add field in the DB
ALTER TABLE `jos_users` ADD `phone` int NOT NULL AFTER `username`;
Step 3. Edit Default.php template file for user to add extra field details during registration
open file as below:
YOUR_SITE/components/com_user/views/register/tmpl/default.php
<tr>
<td height="40">
<label id="phonemsg" for="phone">
<?php echo JText::_( 'Phone' ); ?>:
</label>
</td>
<td>
<input class="inputbox required validate-phone" type="text" id="phone" name="phone" size="40" value="" /> *
</td>
</tr>
Step 4. Edit form.php template file for user to edit profile with extra field
open below file:
YOUR_SITE/components/com_user/views/user/tmpl/form.php
<tr>
<td>
<label for="phone">
<?php echo JText::_( 'phone' ); ?>:
</label>
</td>
<td>
<input class="inputbox validate-phone" type="text" id="phone" name="phone" size="40" />
</td>
</tr>
Step 5. Edit default.php to add extended registration columns in the table view
open below file:
YOUR_SITE/administrator/components/com_users/views/users/tmpl/default.php
//table heading
<th width="15%" class="title">
<?php echo JHTML::_('grid.sort', 'phone', 'a.phone', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
</th>
//display data
<td>
<?php echo $row->phone; ?></a>
</td>
Step 6. Edit form.php template file for user to edit profile with extra field to handle user creation or edit by admin
open below file:
YOUR_SITE/administrator/components/com_users/views/user/tmpl/form.php
<tr>
<td class="key">
<label for="phone">
<?php echo JText::_( 'phone' ); ?>
</label>
</td>
<td>
<?php if(!$this->user->get('phone')) : ?>
<input class="inputbox disabled" type="text" name="phone" id="phone" size="40" value="" disabled="disabled" />
<?php else : ?>
<input class="inputbox" type="text" name="phone" id="phone" size="40" value=""/>
<?php endif; ?>
</td>
</tr>
Thats it. Enjoy. Best of luck
- ranwilli
- Joomla! Master
- Posts: 19203
- Joined: Sun Feb 19, 2006 6:47 pm
- Location: Toledo, OH
- Contact:
Re: Add fields to Joomla! registration form
Or just install Community Builder
Don't HACK the Joomla! core, Instead "Extend" and/or "Override."
Stay ON the update path.
https://harpervance.com
Stay ON the update path.
https://harpervance.com
-
- Joomla! Apprentice
- Posts: 13
- Joined: Mon Oct 24, 2011 11:18 pm
Re: Add fields to Joomla! registration form
which community builder plug-in would you use for adjusting the registration page and allowing admin to approve user registration before they have access? Is profile Pro the one I need from Community Builder to achieve this?
- ranwilli
- Joomla! Master
- Posts: 19203
- Joined: Sun Feb 19, 2006 6:47 pm
- Location: Toledo, OH
- Contact:
Re: Add fields to Joomla! registration form
No plug-ins necessary, CB can be configured to require Admin Approval for activation of a registration.
CB's MAIN purpose is to permit the recording and display of additional fields for the user.
CB's MAIN purpose is to permit the recording and display of additional fields for the user.
Don't HACK the Joomla! core, Instead "Extend" and/or "Override."
Stay ON the update path.
https://harpervance.com
Stay ON the update path.
https://harpervance.com
-
- Joomla! Apprentice
- Posts: 13
- Joined: Mon Oct 24, 2011 11:18 pm
Re: Add fields to Joomla! registration form
can you please send me a link to the community builder that I would use for Joomla 1.5 to accomplish this?
thanks,
Nick
thanks,
Nick
- ranwilli
- Joomla! Master
- Posts: 19203
- Joined: Sun Feb 19, 2006 6:47 pm
- Location: Toledo, OH
- Contact:
Re: Add fields to Joomla! registration form
Don't HACK the Joomla! core, Instead "Extend" and/or "Override."
Stay ON the update path.
https://harpervance.com
Stay ON the update path.
https://harpervance.com
-
- Joomla! Apprentice
- Posts: 7
- Joined: Thu Nov 04, 2010 6:28 pm
Re: Add fields to Joomla! registration form
If you plan to upgrade from 1.5 to 1.6+ any time soon, you will find that 1.6 provides a clean solution with User - Profile plug-ins. I have had good success using this solution in my 1.7 site.
You can start developing your plug-in based on the sample included in the installation package, although as of 1.7 it is a very basic example to which I have had to make many improvements to get what I needed. Also see the article at http://docs.joomla.org/Creating_a_profile_plugin for a simpler example.
You can start developing your plug-in based on the sample included in the installation package, although as of 1.7 it is a very basic example to which I have had to make many improvements to get what I needed. Also see the article at http://docs.joomla.org/Creating_a_profile_plugin for a simpler example.
-
- Joomla! Apprentice
- Posts: 13
- Joined: Mon Oct 24, 2011 11:18 pm
Re: Add fields to Joomla! registration form
thanks for the response, I will keep that it mind when I upgrade my Joomla. Community Builder is currently working great for this.
-
- Joomla! Fledgling
- Posts: 2
- Joined: Mon Jul 15, 2013 8:40 am