Hello.
I try to implement my own authorization scheme - connect MediaWiki to the user database of my other site.
When someone is logged into my portal, and he has an account in MediaWiki, I want him to be logged into MediaWiki.
As a first step to achieve this, I wanted to do an autologin of Pmuszynski. This is my function attaced to UserLoadFromSession hook:
function pmUserAuth($user, &$result) {
$user = User::NewFromName('Pmuszynski'); $id = User::idFromName('Pmuszynski'); $user->setId( $id ); $user->loadfromId(); wfSetupSession(); $user->setCookies(); $user->setToken(); $user->saveSettings(); $user->saveToCache() ; $result = true; return true; };
But I'm getting following error on entering Wiki:
Warning: array_merge(): Argument #1 is not an array in /wiki/includes/User.php on line 2298 Warning: array_unique() expects parameter 1 to be array, null given in /wiki/includes/User.php on line 2298 Warning: Invalid argument supplied for foreach() in /wiki/includes/User.php on line 3472 Warning: Invalid argument supplied for foreach() in /wiki/includes/User.php on line 3481 MediaWiki internal error.
What am I missing?
Thanks for any help :-)
Pawel