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

有帮助吗?

解决方案

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();
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top