Add fields to Joomla! registration form

For Joomla! 1.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
User avatar
rsdebasis
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Sat Jan 29, 2011 9:46 am

Add fields to Joomla! registration form

Postby rsdebasis » Wed Jan 04, 2012 6:06 am

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

User avatar
ranwilli
Joomla! Master
Joomla! Master
Posts: 19111
Joined: Sun Feb 19, 2006 6:47 pm
Location: Toledo, OH
Contact:

Re: Add fields to Joomla! registration form

Postby ranwilli » Wed Jan 04, 2012 9:47 am

Or just install Community Builder
Don't HACK the Joomla! core. Extend and Override.
Stay ON the update path.
http://harpervance.com

nickwiebe
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Mon Oct 24, 2011 11:18 pm

Re: Add fields to Joomla! registration form

Postby nickwiebe » Fri Feb 17, 2012 11:02 pm

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?

User avatar
ranwilli
Joomla! Master
Joomla! Master
Posts: 19111
Joined: Sun Feb 19, 2006 6:47 pm
Location: Toledo, OH
Contact:

Re: Add fields to Joomla! registration form

Postby ranwilli » Sat Feb 18, 2012 1:35 am

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.
Don't HACK the Joomla! core. Extend and Override.
Stay ON the update path.
http://harpervance.com

nickwiebe
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Mon Oct 24, 2011 11:18 pm

Re: Add fields to Joomla! registration form

Postby nickwiebe » Mon Feb 20, 2012 3:11 pm

can you please send me a link to the community builder that I would use for Joomla 1.5 to accomplish this?

thanks,

Nick

User avatar
ranwilli
Joomla! Master
Joomla! Master
Posts: 19111
Joined: Sun Feb 19, 2006 6:47 pm
Location: Toledo, OH
Contact:

Re: Add fields to Joomla! registration form

Postby ranwilli » Mon Feb 20, 2012 3:46 pm

Don't HACK the Joomla! core. Extend and Override.
Stay ON the update path.
http://harpervance.com

wwebb
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Thu Nov 04, 2010 6:28 pm

Re: Add fields to Joomla! registration form

Postby wwebb » Thu Feb 23, 2012 8:35 pm

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.

nickwiebe
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Mon Oct 24, 2011 11:18 pm

Re: Add fields to Joomla! registration form

Postby nickwiebe » Thu Feb 23, 2012 8:39 pm

thanks for the response, I will keep that it mind when I upgrade my Joomla. Community Builder is currently working great for this.

Wiredin
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Mon Jul 15, 2013 8:40 am

Re: Add fields to Joomla! registration form

Postby Wiredin » Fri Jul 26, 2013 11:52 am

Here is the full video explanation on how to do this.

http://youtu.be/2AyCzb2vTaU


Return to “Joomla! 1.5 Coding”

Who is online

Users browsing this forum: No registered users and 2 guests