>>>> "DF" == Daniel Friesen
<lists(a)nadir-seen-fire.com> writes:
DF> That code is a mess... I would
suggest not depending on the exact order and
DF> equality of class strings, it's possible that future code changes
DF> may add new classes or change the order of those.
OK, here is what I reduced it to. Note I totally depend on the var_dumps
to see what is coming my way, so perhaps you could tighten/loosen up my
code to make it more future-proof. Thanks.
function JidanniLessRedNavigation($sktemplate,$links){
// var_dump('BEFORE',$links);
if(!$sktemplate->mTitle->quickUserCan('createtalk')){
foreach(array_keys($links['namespaces']) as $ns){
if(strpos($ns,'talk')!==false){
if('new'==$links['namespaces'][$ns]['class']){
unset($links['namespaces'][$ns]);}}}}
if(isset($links['namespaces']['category']['class'])&&
'selected
new'==$links['namespaces']['category']['class']){
$links['namespaces']['category']['class']='selected';}
// var_dump('AFTER',$links);
return true;}
$wgHooks['SkinTemplateNavigation'][]='JidanniLessRedNavigation';