$member_handler =& xoops_gethandler('member');
//User Object. our new user that we want to insert to xoops
$newuser =& $member_handler->createUser();
//Set some variables
$newuser->setVar('user_viewemail', $user_viewemail, true);
$newuser->setVar('uname', $uname, true); //username
$newuser->setVar('email', $email, true); //email address
if ($url != '') {
$newuser->setVar('url', formatURL($url), true); //url
}
$newuser->setVar('user_avatar', 'blank.gif', true); //avatar
$newuser->setVar('pass', md5($pass), true); //password
$newuser->setVar('timezone_offset', $timezone_offset, true); //timezone offset ex: -8
$newuser->setVar('user_regdate', time(), true);
$newuser->setVar('uorder', $xoopsConfig['com_order'], true);
$newuser->setVar('umode', $xoopsConfig['com_mode'], true);
// 1 is yes, 0 is no. (Receive occasional email notices...option)
$newuser->setVar('user_mailok', $user_mailok, true);
//0 is for the user to activate
//1 is for automatic activation
//2 is for admin activation.
//but 0 and 2 need more code for it to work
$newuser->setVar('level', 1, true);
//Insert the user
if (!$member_handler->insertUser($newuser)) {
echo _US_REGISTERNG; //an error message if we cannot add the user.
exit();
}
$newid = $newuser->getVar('uid');
//add our new user to the Users group, which is actually the number 2
if (!$member_handler->addUserToGroup(XOOPS_GROUP_USERS, $newid)) {
echo _US_REGISTERNG; //a message to show that the user was registered succesfully
exit();
}
i believe you can also pass an array for the fields and an array for the values in that setVar( method . but i havent tried that before.
(ノ◕ヮ◕)ノ*:・゚✧