"BTM" == Bryan Tong Minh bryan.tongminh@gmail.com writes:
BTM> On Fri, Feb 13, 2009 at 9:16 PM, jidanni@jidanni.org wrote:
How can one link to a [[:Category:With members, but no text]] but with no action=edit produced?
BTM> You could create a hook to LinkBegin that sets $options[] = 'known' if BTM> it is a category page:... OK, thanks. The following seems to work. In Template:C, put: [[:Category:{{{1}}}|{{{1}}}]][[Category:{{{1}}}]]<noinclude> ==Explanation== The categories on our wikis are very special. There are thousands of them, one for each bus stop, or police radio frequency. However, we don't want users editing them. They should edit pages, not categories. They should place the bus stop or police frequency onto the page for that bus route, or police station, using this template. This template will #Add the category to [[Special:Categories]] #Make a link to that category ==Usage example== <nowiki> *{{c|Nurdsburg Junction}} </nowiki> ==Hooks== [[Special:Version#Hooks|Hooks]] are employed to avoid "redlinks", without resorting to <nowiki>{{fullurl}}</nowiki>. </noinclude>
And here are the hooks. Requires MediaWiki 1.14. In LocalSettings.php use: function JidanniBlueLinkCategoryPages($linker,$target,&$text,&$customAttribs,&$query,&$options,&$ret){ switch($target->mNamespace){case NS_CATEGORY:case NS_CATEGORY_TALK:$options[0]='known';}return true;} $wgHooks['LinkBegin'][]='JidanniBlueLinkCategoryPages'; function JidanniDontInviteEdit(&$this,&$outputDone,&$pcache){$z=$this;if($z->getID()===0){ switch($z->mTitle->getNamespace()){case NS_CATEGORY:case NS_CATEGORY_TALK:$outputDone=true;}}return true;} $wgHooks['ArticleViewHeader'][]='JidanniDontInviteEdit';# https://bugzilla.wikimedia.org/show_bug.cgi?id=17630 $wgNamespaceProtection[NS_CATEGORY]=$wgNamespaceProtection[NS_CATEGORY_TALK]=array('editinterface'); $wgSpecialVersionShowHooks=true;