1
louis33
Creat New Users With PHP
  • 2006/10/19 16:21

  • louis33

  • Just popping in

  • Posts: 3

  • Since: 2006/10/19


I'm trying to create a new user account without having to use the XOOPS create a user page. I have made a form and I'm collecting data about a user. I'm asking for them to fill out a user name and password. I want to take that info and insert them into the XOOPS user table so they can log into XOOPS after they fill out my form. Is there a way to do so?
Thanks for you time,
Louis

2
wizanda
Re: Creat New Users With PHP
  • 2006/10/19 17:37

  • wizanda

  • Home away from home

  • Posts: 1585

  • Since: 2004/3/21


Yeh almost, unsure on password, yet you can insert users into the MySQL database...
What I do when I am moving my site about, just have a file with all users, only thing unsure about is the password as i think that is encrypted....

3
louis33
Re: Creat New Users With PHP
  • 2006/10/19 17:49

  • louis33

  • Just popping in

  • Posts: 3

  • Since: 2006/10/19


I can insert all the data I need to into the database but I don't know how to generate the actkey.

4
louis33
Re: Creat New Users With PHP
  • 2006/10/19 20:02

  • louis33

  • Just popping in

  • Posts: 3

  • Since: 2006/10/19


I found out how to generate all the info for the user table but when I log in with that user XOOPS said that the user is not allowed to access the any pages. What table do you set privs in?

5
Mithrandir
Re: Creat New Users With PHP

You need to add the user to the registered users group.

// Get new user object
$member_handler =& xoops_gethandler('member');
$newuser =& $member_handler->createUser();

// Set user variables - either directly or from form values
$newuser->setVar('uname'$uname);
$newuser->setVar('email'$email);
$newuser->setVar('pass'md5($pass), true);

// Automatically calculated values
$newuser->setVar('user_regdate'time(), true);
$actkey substr(md5(uniqid(mt_rand(), 1)), 08);
$newuser->setVar('actkey'$actkeytrue);

// Insert the user in the database
$member_handler->insertUser($newuser);

// Add the user to the registered users group
$member_handler->addUserToGroup(XOOPS_GROUP_USERS$newuser->getVar('uid'));
"When you can flatten entire cities at a whim, a tendency towards quiet reflection and seeing-things-from-the-other-fellow's-point-of-view is seldom necessary."

Cusix Software

Login

Who's Online

221 user(s) are online (170 user(s) are browsing Support Forums)


Members: 0


Guests: 221


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits