Pages

Showing posts with label joomla. Show all posts
Showing posts with label joomla. Show all posts

Monday, March 21, 2011

Joomla Password generation

Use the below code for generating joomla password.

        $new_password = "Your password";
       $salt = JUserHelper::genRandomPassword(32);
$crypt = JUserHelper::getCryptedPassword($new_password, $salt);
        $password = $crypt.':'.$salt;

I hope it will help you.. 

Monday, March 7, 2011

Add new fields in joomla registration form

Let us add a custom field phone and mobile in registration form
libraries\joomla\database\table\user.php it’s the class file tor user table/user object
function __construct( &$db )
//add new field
var $phone = null;
var $mobile= null;
after that open
libraries\joomla\libraries\joomla\user\user.php
//add this code
var $phone = null;
var $mobile= null;
Add two fields in users table
ALTER TABLE jos_users ADD phone varchar(255) DEFAULT '' 
AFTER password;
ALTER TABLE jos_users ADD mobile varchar(255) DEFAULT '' 
AFTER phone;

Now go to Now go to administrator\components\com_users\views\
user\tmpl

<tr>
<td width="150">
<label for="phone">
 <?php echo JText::_( 'Phone' ); ?>
</label>
</td>
<td>
<input type="text" name="phone" id="phone" size="40"
 value="<?php echo $this->user->get('phone'); ?>" />
</td>
</tr>
<tr><td width="150">
<label for="mobile">
<?php echo JText::_( 'Mobile' ); ?>
</label>
</td>
<td>
<input type="text" name="mobile" id="mobile" size="40"
value="<?php echo $this->user->get('mobile'); ?>" />
</td>
</tr>
Also in components\com_user\views\register\tmpl
<tr>
<td height="40">
<label id="phonemsg" for="phone">
<?php echo JText::_( 'Phone' ); ?>:
</label>
</td>
<td>
<input type="text" name="phone" id="phone" size="40"
 value="<?php echo $this->escape($this->user->get( 'phone' ));?>" 
maxlength="50" /> *
</td>
</tr>
<tr>
<td height="40">
<label id="websitemsg" for="mobile">
<?php echo JText::_( 'Mobile' ); ?>:
</label>
</td>
<td>
<input type="text" name="mobile" id="mobile" size="40"
value="<?php echo $this->escape($this->user->get( 'mobile' ));?>" 
maxlength="50" /> *
</td>
</tr>