Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

User Creation Example?

edited February 2007 in Vanilla 1.0 Help
I'm starting a Vanilla installation for a userbase that is drawn from an application other than a browser. I can use HTTP GET to communicate to the webserver and create users, and that way I can ensure they're users of the other app. Anyone have a chunk of code that shows how to use UserManager to create users? Just a rough framework would even help. :) TY, K.

Comments

  • edited August 2006
    That should work:
    people.php?PostBackAction=Apply&Email=' . $Email . '&Name=' . $UserName . '&NewPassword=' . $Pw . '&ConfirmPassword=' . $Pw;
    The actual script can use the POST or GET array. It try to get a value in the GET array, and if it doesn't find there it look for it in the POST array.
  • Oh wow! That's easier than I could have imagined! Thank you so much!
  • edited August 2006
    If you want to use UserManager directly:include("appg/settings.php"); $Configuration['SELF_URL'] = 'urlpage.php'; include("appg/init_vanilla.php"); ... $Applicant = $Context->ObjectFactory->NewContextObject($Context, 'User'); $Applicant->Name = $username; $Applicant->Email = $email; $Applicant->NewPassword = $pw; $Applicant->ConfirmPassword = $pw; (EDIT: forgot this one... $Applicant->AgreeToTerms = true;) $UserManager = $Context->ObjectFactory->NewContextObject($Context, 'UserManager'); $UserManager->CreateUser($Applicant);
  • I've used your example almost line for line, and the following code fails silently. Anyone have an idea what I may be doing wrong? include("appg/settings.php"); $Configuration['SELF_URL'] = '3rdwave.php'; include("appg/init_people.php"); $Applicant = $Context->ObjectFactory->NewContextObject($Context, 'User'); $Applicant->Name = "testuser"; $Applicant->Email = "testuyser@mynewhost.com"; $Applicant->NewPassword = "newpassword"; $Applicant->ConfirmPassword = "newpassword"; //$Applicant->Discovery = "uuid"; $UserManager = $Context->ObjectFactory->NewContextObject($Context, 'UserManager'); $UserManager->CreateUser($Applicant);
  • MarkMark Vanilla Staff
    Try adding this after the createuser call to see if there were any warnings:

    $Context->WarningCollector->Write();
  • edited August 2006
    I had forgotten:$Applicant->AgreeToTerms = true;
  • And in case you would still try a link:people.php?PostBackAction=Apply&Email=' . $Email . '&Name=' . $UserName . '&NewPassword=' . $Pw . '&ConfirmPassword=' . $Pw&AgreeToTerms=1;
  • edited August 2006
    Dinoboff, are you willing to provide the same sort of thing for logon, logoff, and change password. Thanks for the registration example. You've saved me gobs of time. Oh, I almost forgot, what is the second line all about $Configuration['SELF_URL'] = 'urlpage.php'; what page does that refer to? Thanks again.
  • The SelfUrl thing tells the rest of the application (extensions etc) what page of the program you're on. It means that stuff which isnt meant to show on that page wont.
  • edited August 2006
    @blowfish...

    I've just posted a change password example here... http://lussumo.com/community/discussion/3340/
    and I think you're already aware it has the login and logout examples there too.
  • thank you very much.
  • Hello everyone, I'm new around here, and was looking for a solution to a very similar problem. I'm posting my solution here in the hope that others might find it useful. I have people signing up on our website (http://adinxight.com), and when someone signs up, I wanted to automatically create user accounts for them, using their e-mail address as their user name. Moreover, I did not want to have to approve them as admin. So I could not use HTTP GET technique outlined earlier in this thread. My solution was to go directly to MySQL to insert a record into the LUM_User table. I borrowed the insert statement from the file setup/mysql.sql in the Vanilla distribution, and wrote a little wrapper shell script to do the insert. Seems to work so far. Here is the script (with the database name, user name and password replaced with xxx): #! /bin/sh # # Shell script to create a new forum user for the Vanilla database emailAddress=$1 firstName=$2 lastName=$3 dateStamp=`date "+%Y-%m-%d %H:%M:%S"` mysql -u xxx -pxxx -D xxx <<EOF INSERT INTO LUM_User (RoleID, StyleID, FirstName, LastName, Name, Password, Email, UtilizeEmail, ShowName, CountVisit, CountDiscussions, CountComments,SendNewApplicantNotifications) values (3,1,'$firstName','$lastName','$emailAddress','adinxight-user','$emailAddress','1','1',0,0,0,'1'); EOF Hope this helps.
This discussion has been closed.