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
Update: oh I ddin't see you wanted 1.5 but you could do similar but wth the 1.5 API instead.
This is part of something I was usng for anther purpose but you would need to use the default group instead until an issue with using JUserHelper from the command line is fixed or make it a web application.
input->get('username', null,'STRING');
$name = $this->input->get('name');
$email = $this->input->get('email', '', 'EMAIL');
$groups = $this->input->get('groups', null, 'STRING');
// Short args
if (!$username)
{
$username = $this->input->get('u', null, 'STRING');
}
if (!$name)
{
$name = $this->input->get('n');
}
if (!$email)
{
$email = $this->input->get('e', null, 'EMAIL');
}
if (!$groups)
{
$groups = $this->input->get('g', null, 'STRING');
}
$user = new JUser();
$array = array();
$array['username'] = $username;
$array['name'] = $name;
$array['email'] = $email;
$user->bind($array);
$user->save();
$grouparray = explode(',', $groups);
JUserHelper::setUserGroups($user->id, $grouparray);
foreach ($grouparray as $groupId)
{
JUserHelper::addUserToGroup($user->id, $groupId);
}
$this->out('User Created');
$this->out();
}
}
if (!defined('JSHELL'))
{
JApplicationCli::getInstance('Adduser')->execute();
}