Extension talk:HideNamespace

no effect
At the moment the extension isn't working for me on Mediawiki 1.15.1. I followed the directions given for installation (except HideNamespace.i18n

was renamed to HideNamespace.i18n.php because the wiki errors out otherwise). Neither the parser or declaring namespaces to

hide with $wgHidensNamespaces have any effect. Special:Version shows the extension is registered successfully.

210.56.88.218 12:22, 1 September 2009 (UTC)


 * I've received some reports describing the same problem. I've looked into it, but found nothing wrong. There are maybe some problems with registering the hooks, but since I can't reproduce it's difficult to fix it. --Matěj Grabovský 14:28, 1 September 2009 (UTC)


 * Yeah I spent a while trying to trace the problem and came up empty (not real familiar with debugging MediaWiki or PHP in general). So in the meantime I've just hacked with the Mediawiki codebase a bit and made a couple of patches to strip specific NS prefixes in article pages and category listings. Thanks anyway. 210.56.88.15 15:52, 1 September 2009 (UTC)


 * I just got a little pointer, could you please provide list of installed extensions? --Matěj Grabovský 16:18, 1 September 2009 (UTC)


 * Just yours... I was testing it out on a fresh install of MediaWiki 1.15.1 with Xampp 1.7.1 on my local box. Only modification had been an import of an XML dump from my production wiki. 210.56.88.15 16:30, 1 September 2009 (UTC)


 * It should work now, try the new code. --Matěj Grabovský 13:53, 2 September 2009 (UTC)


 * You're not declaring parser functions correctly.. I had to disable function RegisterParser. See this page to see how parser functions are set up in later versions of MW Manual:Parser_functions --Frantik 10:56, 17 September 2009 (UTC)


 * I think I'm doing it right. --Matěj Grabovský 13:46, 17 September 2009 (UTC)


 * Unfortunately it's not working for me either. It just gives me the following error: "Internal Error. Set $wgShowExceptionDetails = true; at the bottom of LocalSettings.php to show detailed debugging information." BTW I'm using MW 1.14. Regards, BradLeeBH 04:12, 25 September 2009 (UTC)


 * It did not seem to work for me either. But it seems quite awesome, except for that. Alshgjdkjcej

This extension does nothing.

problem : Magic word 'hidens' not found
Hello, i've done everything as stated but i've this error:

Magic word 'hidens' not found

Backtrace:


 * 0 C:\wamp\www\mediawiki\includes\MagicWord.php(244): Language->getMagic(Object(MagicWord))
 * 1 C:\wamp\www\mediawiki\includes\MagicWord.php(197): MagicWord->load('hidens')
 * 2 C:\wamp\www\mediawiki\includes\parser\Parser.php(4034): MagicWord::get('hidens')
 * 3 C:\wamp\www\mediawiki\extensions\HideNamespace\HideNamespace.php(64): Parser->setFunctionHook('hidens', Array)
 * 1) 4 [internal function]: ExtensionHideNamespace->RegisterParser(Object(Parser))
 * 5 C:\wamp\www\mediawiki\includes\Hooks.php(117): call_user_func_array(Array, Array)
 * 6 C:\wamp\www\mediawiki\includes\parser\Parser.php(178): wfRunHooks('ParserFirstCall...', Array)
 * 7 C:\wamp\www\mediawiki\includes\parser\Parser.php(190): Parser->firstCallInit
 * 8 C:\wamp\www\mediawiki\includes\parser\Parser.php(312): Parser->clearState
 * 9 C:\wamp\www\mediawiki\includes\OutputPage.php(651): Parser->parse('(Redirig?? depu...', Object(Title), Object(ParserOptions), true, true, NULL)
 * 1) 10 C:\wamp\www\mediawiki\includes\GlobalFunctions.php(740): OutputPage->parse('(Redirig?? depu...', true, true)
 * 2) 11 C:\wamp\www\mediawiki\includes\Article.php(841): wfMsgExt('redirectedfrom', Array, 'view
 * 4) 13 C:\wamp\www\mediawiki\includes\Wiki.php(63): MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest))
 * 5) 14 C:\wamp\www\mediawiki\index.php(116): MediaWiki->initialize(Object(Title), Object(Article), Object(OutputPage), Object(User), Object(WebRequest))
 * 6) 15 {main}

could you help me please??

thanks for your help


 * What MediaWiki version are you using? --Matěj Grabovský 15:53, 2 August 2010 (UTC)
 * Hello i use
 * version of Mediawiki : 1.15.4
 * Database : MySql 5.1.36
 * OS : windows xp pro 2003
 * PHP version : 5.2.11
 * serveur Apache 2.2.11


 * MediaWiki works on a local configuration with wampserver 2.--Eva 08:38, 6 August 2010 (UTC)


 * Would you have an idea please?
 * thanks for your help
 * --Eva 09:46, 10 August 2010 (UTC)


 * Sorry for the very long delay, you can now download the code for MW 1.15 through the Extension Distributor or directly from SVN. --Matěj Grabovský 14:27, 10 August 2010 (UTC)


 * thanks it works --Eva 08:46, 11 August 2010 (UTC)
 * You're welcome, thanks for noticing me. --Matěj Grabovský 08:37, 11 August 2010 (UTC)

Error: Unsupported operand types in HideNamespace.php on line 49
First of all thanks for putting effort in this extension. It is a much anticipated one! However when I use it on my wiki (1.15.3, PHP 5.2.13, MySQL 5.0.91) and HideNamespaces version 1.4.1 it says "Fatal error: Unsupported operand types in .../public_html/okwiki/extensions/HideNamespace/HideNamespace.php on line 49".

Oddly enough, if I only activate HideNamespace.php it doesnt crash, but doesn't work either.

When I add HideNamespace.i18n.php, it doesnt crash but doesn't work either.

When I add HideNamespace.i18n.magic.php it crashes on Line 49 on above mentioned error.

Any idea what can be done? Vadra


 * I've update the code in SVN, it should now be available through ExtensionDistributor. --Matěj Grabovský 17:40, 26 October 2010 (UTC)

For me your new code did not work. I get the error messages similar to Eva's mentioned before. What can I check/do to make it work?
 * What error exactly do you get? --Matěj Grabovský 16:40, 17 November 2010 (UTC)

Not working in 1.16.0
As previously reported for v 1.15.X nor working for higher version. Probably the same problem.--Juan de Vojníkov 01:24, 27 November 2010 (UTC)

Same for me. 87.78.238.6

A possible solution to some of the problems encountered above
As a MediaWiki newbie, forgive me if my edit is any way inappropriate.

I have just been trying to get HideNamespace working with an installation of MediaWiki 1.16.0 (+Ubuntu/PostgreSQL) but the extension was not working: no error message but namespaces were not being removed from article titles either. Then I noticed the sample code to go into the LocalSettings.php (as found under Installation) had a small mistake:


 * the sample code contained "wgHidensNamespaces" when it should have been "wgHideNsNamespaces"

Making this small change did the trick!!!

Franolich 21 December 2010


 * Thank you very much for pointing that out. It was most likely the real cause of all the troubles. I can’t believe nobody has noticed it before, you’re my hero. Thank you. —Matěj Grabovský 20:08, 21 December 2010 (UTC)


 * GREAT Thanks for sharing this important information. I did not see this mistake! By the way I was actually looking for something different. I wanted to hide the namespace prefix on category subpages. I did find a good and working solution here: http://www.mwusers.com/forums/showthread.php?15702-How-to-hide-Category-prefix-in-my-subcategory-lists.

Happy new year!

Fascinating. Because the extension page (http://www.mediawiki.org/wiki/Extension:HideNamespace) is quite explicit that the array name is $wgHidensNamespaces, and even gives a warning saying that it was changed from $wgHideNsNamespaces in version 1.4.3. And examing the php file, the name does appear to be $wgHidensNamespaces. So unless there are two arrays, this must be an old note. Aeric 30 Nov 2012

195.14.222.217 13:04, 31 December 2010 (UTC)

Namespace removal does not work on discussion tabs
While continuing to test HideNamespace on my first MediaWiki site, I noticed that namespace removal was not working properly on discussion tabs. Specifically, only the first letter was being removed (eg. "ategory talk:Courses"). Eventually I noticed this problem only occurred when the discussion page did not already exist - as soon as I added some content all was fine.

The bug turned out to be because the ArticleViewHeader handler does not appear to be called on pages that do not exist yet (so $namespace and $namespaceL10n were left uninitialised). A solution, which I have tested, is to add a handler for the EditFormPreloadText event (there may be a better choice of event) and essentially run the same code as the ArticleViewHeader handler (with minor modifications):

... function wfHideNamespaceSetup { ...	$wgHooks['EditFormPreloadText'][] = array( &$extHidensObj, 'onEditFormPreloadText' ); ... } ... class ExtensionHideNamespace { ...	function onEditFormPreloadText( &$text, &$title ) { self::$namespace = $title->mNamespace;

if( self::$namespace === NS_MAIN ) { self::$namespaceL10n = ''; } else { self::$namespaceL10n = substr( $title->getPrefixedText, 0,				strpos( $title->getPrefixedText,':' ) ); }		return true; }

... }

At the end of my testing, I discovered there are other situations where the above problem arises, eg after deleting a page the confirmation title is transformed to "ction complete". This can be remedied by checking that $namespaceL10n has been initialised in the OutputPageBeforeHTML handler:

function onBeforePageDisplay( &$out, $skin ) { ...	$len = strlen( self::$namespaceL10n ); if ($len > 0) { $out->setPageTitle( substr( $out->getPageTitle, $len + 1 ) ); }	... }

By the way, thank you so much for a very handy extension. Without your code I would not have known where to start with developing extensions. Cheers!

Franolich 21 December 2010


 * I cannot reproduce this behaviour. However, try the updated version. Also, you're welcome. —Matěj Grabovský 13:36, 31 December 2010 (UTC)

Problem with Magic Word "DISPLAYTITLE"
I used in some pages the DISPLAYTITLE magic word to show a different title from the default one and I notices it was cut at some point. HideNamespace cuts off the initial part of the title for as much character as the namespace is. Example: my page is titled MyNS:Title_of_the_page, with DISPLAYTITLE:My new title, it is shown "w title".

I hope this can be set up. Thank you. --Gborgonovo (talk) 13:35, 20 March 2014 (UTC)


 * Maybe it is a solution. In the HideNamespace.php file I changes the check in the "onBeforePageDisplay" method, like this.
 * It seems to work. --Gborgonovo (talk) 13:51, 20 March 2014 (UTC)
 * It seems to work. --Gborgonovo (talk) 13:51, 20 March 2014 (UTC)