Thread:Project:Support desk/How to hide "View History" button for unlogged users?/reply (35)

Made the following changes and it worked on Mediawiki 1.22.5

$wgUser->isLoggedIn >>>> $skin->getUser->isLoggedIn

$wgHooks['BeforePageDisplay'][] = 'efAddSkinStylesAnon'; >>>> 'efAddSkinStyles'

function efAddSkinStyles(OutputPage &$out, Skin &$skin) { if(!$skin->getUser->isLoggedIn) { if ($skin->getSkinName == 'vector') { $out->addInlineStyle('#ca-history { display:none; }'); }   } else { if ($skin->getSkinName == 'vector') { $out->addInlineStyle('#ca-view { display:none; }'); }   }

return true; } $wgHooks['BeforePageDisplay'][] = 'efAddSkinStyles';