1
CapMontoro
creating new users automatically with php and xoops API
  • 2005/5/26 0:30

  • CapMontoro

  • Just popping in

  • Posts: 6

  • Since: 2005/5/11


Hi, I have:

1) a working marketplace (not a XOOPS site)
2) a company XOOPS site

My problem is that when I create a new user in the marketplace (with known user & password) I would like that a new user would be automatically created in XOOPS with the same user & password.

I know there is a XOOPS API method called createUser (member of XoopsMemberHandler) but I did not found any code sample about how to use it.

Could some of you write a small code sample of how to create a new user (not admin just a nromal user) using XOOPS API? (for example user="Jack" password="black") and add it to a group?

Thank you all in advance!

2
hervet
Re: creating new users automatically with php and xoops API
  • 2005/5/26 17:30

  • hervet

  • Friend of XOOPS

  • Posts: 2267

  • Since: 2003/11/4


Hello,

You can also use the "option" to directly write users informations in the database. As a starting point, you can see this post

Bye,
Hervé

3
Mithrandir
Re: creating new users automatically with php and xoops API

$member_handler =& xoops_gethandler('member');
$user =& $member_handler->createUser();
$user->setVar('uname'$user_name); //replace $user_name with your own variable
$user->setVar('pass'md5($password));
if (
$member_handler->insertUser($user)) {
    
//user created
}
else {
    
//user not created successfully, you can perhaps get error messages with this:
    
$errors_array $user->getErrors();
}

4
Furious
Re: creating new users automatically with php and xoops API
  • 2005/5/26 17:46

  • Furious

  • Just popping in

  • Posts: 4

  • Since: 2005/5/17


Quote:

Mithrandir wrote
$user->setVar('pass', md5($password);


This line appears to be missing a closing ')' for the setVar call.

5
Mithrandir
Re: creating new users automatically with php and xoops API

It certainly does - I always put in some typos just so that you don't get everything for free

(thanks for that. I always make typos when not using my IDE with syntax highlighting)

6
CapMontoro
Re: creating new users automatically with php and xoops API
  • 2005/5/27 0:54

  • CapMontoro

  • Just popping in

  • Posts: 6

  • Since: 2005/5/11


Thanks Mithrandir! (thank you also Hervet) Now the user is created!

would be too much ask about how to automatically include the new user in an existing group?

Login

Who's Online

264 user(s) are online (150 user(s) are browsing Support Forums)


Members: 0


Guests: 264


more...

Donat-O-Meter

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

Latest GitHub Commits