I have tried a few way to Crypt the password for the database. I have tried with out salting before entering it in to the DB Query and i have tried with a few function to salt before entering it. Not sure what i mite be missing. Below i will display the ways i have tried if anyone mite see what i am missing.
First Try:
$mypassword = JUserHelper::genRandomPassword(10);$salt = JUserHelper::genRandomPassword(32);
$crypt = JUserHelper::getCryptedPassword($mypassword, $salt);
$password_hash = $crypt.':'.$salt;
//below is how i imputed it to my array.
$udata = array(
'name'=>$nUser,
'username'=>$nUser,
'password'=>$password_hash,
'email'=>$nMail,
'groups'=>array(2), // set the usergroup(s) here (id)
);
Second Try:
$udata = array(
'name'=>$nUser,
'username'=>$nUser,
'password'=>password_hash($mypassword, PASSWORD_DEFAULT),
'email'=>$nMail,
'groups'=>array(2), // set the usergroup(s) here (id)
);
Also Tried This:
$udata = array(
'name'=>$nUser,
'username'=>$nUser,
'password'=>JUserHelper::genRandomPassword(15),
'email'=>$nMail,
'groups'=>array(2), // set the usergroup(s) here (id)
);
This last one was with out hashing it just create the pass right in the array.
But with all trys i get this message on front end.
If i log in to the back end the account is there but can not log in till i change the password from the back end.
EDIT: Added Content.
function nUser_joomla($nUser, $myuuid, $myobject)
{
//$nUser = 'Test User 3';//$_GET['name'] <== Put this when using SL to URL Registration.
$arr = array($myobject,'@lsl.secondlife.com');
$nMail = implode("",$arr);
$udata = array(
'name'=>$nUser,
'username'=>$nUser,
'password'=> ***THIS IS WHERE I PUT THE PASSWORD STRING.***,
'email'=>$nMail,
'groups'=>array(2), // set the usergroup(s) here (id)
);
$user = new JUser;
$user->bind($udata);
$user->save();
$userId = JUserHelper::getUserId($nUser);
//return $userId;
//The Issue Is Up Here ^^^^
/// *** Everything Below is working
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$sql = $db->getQuery(true);
$columns = array('id', 'asset_id', 'ordering', 'jid', 'sl_name', 'sl_uuid');
$values = array(0, 0, 1, $userId, $db->quote($nUser), $db->quote($myuuid));
$sql
->insert($db->quoteName('#__sljooma_user'))
->columns($db->quoteName($columns))
->values(implode(',', $values));
$db->setQuery($sql);
$db->execute();
}
md5()
andmysql_
, but you may be able to make some meaningful script comparisons too. We can't see what you are doing with the generated$udata
. You should output your generated variables to ensure that they contain what you expect.$sql
to check that contains what you expect? Does that generated query work in your phpmyadmin?sljooma_user
vssljoomla_user
. Do you have error reporting turned all the way up?