We\'re creating an XML API for Joomla that allows partner sites to create new accounts for their users on our website.
We\'ve created a standalone PHP script that
Tested and working on 2.5.
function addJoomlaUser($name, $username, $password, $email) {
$data = array(
"name"=>$name,
"username"=>$username,
"password"=>$password,
"password2"=>$password,
"email"=>$email
);
$user = clone(JFactory::getUser());
//Write to database
if(!$user->bind($data)) {
throw new Exception("Could not bind data. Error: " . $user->getError());
}
if (!$user->save()) {
throw new Exception("Could not save user. Error: " . $user->getError());
}
return $user->id;
}
If you're outside the Joomla environment, you'll have to do this first, or if you're not writing a component, use the one in the link in @GMonC's answer.
initialise();
I use this for unit testing my component.