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

Try the following snippet which should hide the history tab for anon users or the "Read" tab for logged in users. Note this only works if they're using the vector skin.

function efAddSkinStyles( OutputPage &$out, Skin &$skin ) { if( !$wgUser->isLoggedIn ) { // Hide history tab for anons if ( $skin->getSkinName == 'vector' ) { $out->addInlineStyle( '#ca-history { display:none; }' ); }       } else { // Hide "Read" tab for those who are logged in               if ( $skin->getSkinName == 'vector' ) { $out->addInlineStyle( '#ca-view { display:none; }' ); }              }

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