Create Joomla registered user by component
Creating a Joomla component that create user, can help you to add user from other forum, script etc… or from a simple mailing list. below function will help you to create a registered user from email address and name. pass the array with your user data.
$qcnewu=array(
'name'=>$gname,
'username'=>$gemail,
'email'=>$gemail,
'password'=>$tmp_pwd,
'password2'=>$tmp_pwd,
'id'=>"0",
'gid'=>"0"
);
function auto_usr($qcnewu)
{
$db =& JFactory::getDBO();
global $mainframe;
$user = clone(JFactory::getUser());
$pathway =& $mainframe->getPathway();
$config =& JFactory::getConfig();
$authorize =& JFactory::getACL();
$document =& JFactory::getDocument();
$newUsertype = 'Registered';
if (!$user->bind( $qcnewu, 'usertype' )) {
JError::raiseError( 500, $user->getError());
}
$user->set('id', 0);
$user->set('usertype', $newUsertype);
$user->set('gid', 18);
$user->set('lastvisitDate', '0000-00-00 00:00:00');
$user->set('sendEmail', 0);
$date =& JFactory::getDate();
$user->set('registerDate', $date->toMySQL());
jimport('joomla.user.helper');
//$user->set('activation', JUtility::getHash( JUserHelper::genRandomPassword()) );
$user->set('block', '0');
// Show error with registration
if ( !$user->save() )
{
//JError::raiseWarning('', JText::_( $user->getError()));
return false;
}else return true;
}