Singapore CMS Web Design

Gary Consulting Group - Singapore CMS Web Design

Timely Support and Clarity in your journey to harness the power of the internet
Email:
sales@name1price.com
Call:
+1 415 300-0019
Extending JUser Adding Fields to Joomla User

Today I have successfully extended the JUser class in Joomla 1.5 include a new field PayPal ID

Here is the general outline of what I did:

Step 1: Extending the jos_user table in the database by adding field paypal_id with SQL statement

ALTER TABLE `jos_users` ADD `paypal_id` VARCHAR(100) NULL AFTER `username`

Step 2: Extending the JTable corresponding to JUser by adding an additional field

Location of JTable is libraries/joomla/database/table/user.php
Code added
/**
* The paypal id
*
* @var string
*/
var $paypal_id = null;

Step 3: Extending the JUser class

Location of the JUser class : libraries/joomla/user/user.php
Code Added
/**
* The paypal id
* @var string
*/
var $paypal_id = null;

Step 4: Extending the Front End View to allow user to input their paypal id

Location of the View : components/com_user/views/register/tmpl/default.php
Code Added
<tr>
<td height="40">
<label id="pw2msg" for="password2">
Paypal ID:
</label>
</td>
<td>
<input type="text" id="paypal_id" name="paypal_id" size="40" value="<?php echo $this->user->get( 'paypal_id' );?>" class="inputbox required validate-email" maxlength="100" /> *
</td>
</tr>

Step 5 : Extending the Back End View to allow Administrator Access to members paypal id

Location of the View : administrator/components/com_users/views/user/tmpl/form.php
Code Added
<tr>
<td class="key">
<label for="username">
Paypal ID
</label>
</td>
<td>
<input type="text" name="paypal_id" id="paypal_id" class="inputbox" size="40" value="<?php echo $this->user->get('paypal_id'); ?>" autocomplete="off" />
</td>
</tr>
Step 6 : Ended This should work fine. You will just need to create a menu that points to the user registration function in the front end to see the results for yourself.
 
Wednesday, 22nd Nov 2017
Content Management System powered by Gary from Name1Price.com