[Mediawiki-l] how to create users by php script

Simone Biagini simone.biagini at dflsrl.it
Tue Apr 15 15:00:33 UTC 2008


Hi all,

I hope that this is the right place to ask for help ^_^

I'm trying to script a little php code to add a new user to the wiki by php

I use something simlar to this:

        $newuserarray=array();
        $newuserarray[0]='pippo';
        $newuserarray[1]='pass';
        $newuserarray[2]='prova at mail.com';
        $newuserarray[3]='truename';
       
        $NextUser=User::newFromName( $newuserarray[0] );
       
        $NextUser->setEmail( $newuserarray[2] );
        $NextUser->setRealName( $newuserarray[3] );
        $uid=$NextUser->idForName();
        if ($uid===0) {
          $NextUser->addToDatabase();
          $NextUser->setPassword( $newuserarray[1] );
          $NextUser->saveSettings();
        }


running it $NextUser is correctly created but the user is non in the 
MySQL table (user)

what I'm doing wrong ?

thanks



More information about the MediaWiki-l mailing list