Question

I'm try to create media wiki user programmatically on UserLoadFromSession hooks. I use follwing code to create user

$user12 = new User();
$user12->setToken();
$user12->mEmail  = $email;
$user12->mName  = $userName; // Redundant given use of loadDefaults...?
$user12->mRealName  = $RealName;
$mystatus = $user12->addToDatabase();

when i check status ok i debug upto doQuery function on DatabaseMysql but it's not create a user on my mysql database. this heppn both on my development environment (Windows computer with mysql server) as well as production (Linux and amazon RDS)

please help me to sort out this

Was it helpful?

Solution

For anyone who has same problem i found a solution since this using inside UserLoadFromSession hooks no need to create user object again, use same user object. and also don't forget to update site statistics too using.

$ssUpdate = new SiteStatsUpdate( 0, 0, 0, 0, 1 );
$ssUpdate->doUpdate();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top