Page 1 of 1

Add fields to Joomla! registration form

Posted: Wed Jan 04, 2012 6:06 am
by rsdebasis
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

Re: Add fields to Joomla! registration form

Posted: Wed Jan 04, 2012 9:47 am
by ranwilli
Or just install Community Builder

Re: Add fields to Joomla! registration form

Posted: Fri Feb 17, 2012 11:02 pm
by nickwiebe
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?

Re: Add fields to Joomla! registration form

Posted: Sat Feb 18, 2012 1:35 am
by ranwilli
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.

Re: Add fields to Joomla! registration form

Posted: Mon Feb 20, 2012 3:11 pm
by nickwiebe
can you please send me a link to the community builder that I would use for Joomla 1.5 to accomplish this?

thanks,

Nick

Re: Add fields to Joomla! registration form

Posted: Mon Feb 20, 2012 3:46 pm
by ranwilli

Re: Add fields to Joomla! registration form

Posted: Thu Feb 23, 2012 8:35 pm
by wwebb
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.

Re: Add fields to Joomla! registration form

Posted: Thu Feb 23, 2012 8:39 pm
by nickwiebe
thanks for the response, I will keep that it mind when I upgrade my Joomla. Community Builder is currently working great for this.

Re: Add fields to Joomla! registration form

Posted: Fri Jul 26, 2013 11:52 am
by Wiredin
Here is the full video explanation on how to do this.

http://youtu.be/2AyCzb2vTaU