Manual talk:$wgNamespacesToBeSearchedDefault
From MediaWiki.org
Important to note that setting this will not override a users preferences. So if you have changed your preferences, changing this will not appear to you, making you think that it hasn't worked --Dr DBW 01:54, 27 June 2007 (UTC)
The above problem, unfortunately, applies even to namespaces created after a user was created/has edited his/her preferences. The problem is that method getOption() in User.php does not fall back to default user options if a particular option does not exist in that user's preferences. This is quite annoying if you use namespaces to categorize article types since there is no easy way to update preferences of all users. The following implementation of getOption() solves the problem - it uses default values for options which the user did not touch yet:
function getOption( $oname, $defaultOverride = '' ) { $this->load(); if ( is_null( $this->mOptions ) ) { if($defaultOverride != '') { return $defaultOverride; } $this->mOptions = User::getDefaultOptions(); } if ( array_key_exists( $oname, $this->mOptions ) ) { return trim( $this->mOptions[$oname] ); } else { ## try to look for a default when the option is not set $defOpts = User::getDefaultOptions(); if ( $defaultOverride == '' && array_key_exists( $oname, $defOpts) ) { return trim( $defOpts[$oname] ); } else { return $defaultOverride; } } }
--Jim Bim 18:32, 17 August 2007 (UTC)
[edit] Problem with line $this -> load()
There seems to be a problem in line 2: $this -> load();
no method "load()" known
probably the correct code is: $this->loadFromDatabase(); ?

