User talk:Otheus/Auto Login via REMOTE USER/code

From Meta, a Wikimedia project coordination wiki

Language independency[edit]

The following line depends on the wiki default language being set to english

if ($title == 'Special:Userlogout' || $title == 'Special:Userlogin') {

because the use of Special as namespace is language dependent.

Please replace with function calls like

Title::makeName(NS_SPECIAL, 'Userlogin')

Xypron 05:26, 4 August 2006 (UTC)[reply]


Compatibility Issues[edit]

This extension works well for mediawiki <= 1.7.x. Things are b0rked in 1.8.x release and the extension does now work. The extension goes into an infinite redirection loop and it does not create user entries in user table. I'm too ignorant on how wiki works to fix it.

Rgiscard

This works if you make modifications in the head of the file: $wgGroupPermissions['*' ]['read'] = true;

alexz 12:39, 25 October 2006

works for 1.8.2 after the above change[edit]

After pulling my hair out for the better part of the day I found the one little comment above, made the change and it works again! COOL! After changing the grouppermission setting no more problems. --Sean 19:01, 27 October 2006 (UTC)[reply]


Error: $this->loadDefaults(); from loadFromSession() in User.php[edit]

Fatal error: Using $this when not in object context in path\to\my\wiki\includes\User.php on line 642

That line is $this->loadDefaults(); in loadFromSession() in User.php when no session or cookie is found.

Has anyone seen or fixed this issue with Auth_remoteuser in mediawiki 1.9 ? 207.114.206.180 09:00, 11 January 2007 (UTC)[reply]

try this:

   // Do nothing if session is valid
   $wgUser = new User();
   $wgUser->loadFromSession();
   if ($wgUser->isLoggedIn()) {
     return;
   }

Fix for error LoadFromSession() in User.php[edit]

If you look inside User.php you see that LoadFromSession is a private function now. You are not allowed to use this method anymore. Instead, the newFromSession() method is added, that provides the same functionality.

Just try this:

    // Do nothing if session is valid
    // OLD: $wgUser = User::loadFromSession(); 
    $wgUser = User::newFromSession();
    if ($wgUser->isLoggedIn()) {
      return;
    }

Grtz, Davidv 15:07, 17 January 2007 (UTC)[reply]

Fix for error LoadFromSession() in User.php works for me in 1.9.1[edit]

The LoadFromSession fix worked for me on a mediawiki 1.9.1 install. I'm running Linux RHE with PHP 5.1.4 and MySQL 5.0.27 --Sean 16:34, 30 January 2007 (UTC)[reply]

Error password-change-forbidden[edit]

Mediawiki 1.9.3

Backtrace:

#0 /var/www/info/wiki/includes/SpecialUserlogin.php(311): User->setPassword('')
#1 /var/www/info/wiki/extensions/Auth_remoteuser.php(79): LoginForm->initUser(Object(User))
#2 [internal function]: Auth_remote_user_hook()
#3 /var/www/info/wiki/includes/Setup.php(219): call_user_func('Auth_remote_use...')
#4 /var/www/info/wiki/includes/WebStart.php(90): require_once('/var/www/info/w...')
#5 /var/www/info/wiki/index.php(4): require_once('/var/www/info/w...')
#6 {main}

I'm running Linux Ubuntu with PHP 5.1.2 and MySQL 5.0.22

Fix That[edit]

change

// disallow password change
function allowPasswordChange() {
    return false;
}

to

// disallow password change
function allowPasswordChange() {
    return true;
}