Re: user insertion
  • 2011/11/5 4:10

  • xoopdio

  • Just popping in

  • Posts: 29

  • Since: 2011/9/27

Thanks for the link (I just happen to see that it's far more useful with javascript enabled.. )

and for the level attribute; level 1 is for people who are activated and level 0 is for those who are not. So everyone should be either a 0 or 1. Sometimes there are some greater than one, but the important thing is that they are greater than 0.

Ok, now it's crystal ! As I was inserting 2 as level value, I could have been waiting and coding a long time..

So now, the module behaves as expected ! I got to test it on a production server as I don't have mail function on my workstation. The next step is to get the process automatized at each registration.

With an Extra thanks to you, I guess it is solved now !

The user_add function code (if it can help someone) :

function user_add($USER_INFOS
        include (
XOOPS_ROOT_PATH '/kernel/user.php';
XOOPS_ROOT_PATH '/kernel/object.php';
XOOPS_ROOT_PATH '/include/functions.php';
$table $this->xoopsDB->prefix('users');
$date time();
$user_avatar 'avatars/blank.gif';
$actkey substr(md5(uniqid(mt_rand(), 1)), 08);
$theme 'zetagenesis';
$member_handler =& xoops_gethandler('member');
$user =& $member_handler->createUser();
$user->setVar('name'$USER_INFOS['NAME'], true);
$user->setVar('uname'$USER_INFOS['UNAME'], true);
$user->setVar('pass'$USER_INFOS['PASS'], true);
$user->setVar('email'$USER_INFOS['EMAIL'], true);
$user->setVar('url'$USER_INFOS['URL'], true);
$user->setVar('user_icq'$USER_INFOS['USER_ICQ'], true);
$user->setVar('user_aim'$USER_INFOS['USER_AIM'], true);
$user->setVar('user_yim'$USER_INFOS['USER_YIM'], true);
$user->setVar('user_msnm'$USER_INFOS['USER_MSNM'], true);
$user->setVar('uorder'$xoopsConfig['com_order'], true);
$user->setVar('umode'$xoopsConfig['com_mode'], true);
$user->setVar('level'0);        // admin activation
$sql 'SELECT uid FROM ' $table ' WHERE uname = '' . 
UNAME'] . '';';             
$result $this->xoopsDB->queryF($sql);
$row $this->xoopsDB->fetchRow($result))
$row as $value)
$UID = (int)$value;
$XoopsMemberShip =& $member_handler->addUserToGroup(2$UID);                          // admin mail
$xoopsMailer =& xoops_getMailer();
$xoopsMailer->assign('USERACTLINK'XOOPS_URL "/modules/" 
$GLOBALS['xoopsModule']->getVar('dirname''n') . '/activate.php?id=' .                          $user->getVar('uid') . '&actkey=' $user->getVar('actkey''n'));
$xoopsMailer->assign('SITEURL'XOOPS_URL "/");             
             if (!
$_SESSION['profile_post']['_message_'] = 2;
             } else {
$_SESSION['profile_post']['_message_'] = 3;
         } else {
//user not created successfully, you can perhaps get error messages with this:
$errors_array $user->getErrors();
"A tree is made of non-tree elements" Thich Nhat Hanh


Who's Online

60 user(s) are online (36 user(s) are browsing Support Forums)

Members: 0

Guests: 60



Goal: $100.00
Due Date: Aug 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits