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

The error you're getting points to the following line:

if( !$wgUser->isLoggedIn ) {

The error was "Call to a member function isLoggedIn on a non-object".

Since $wgUser is a global object, telling PHP to get $wgUser from the global scope just before that line should solve your problem:

global $wgUser; if( !$wgUser->isLoggedIn ) {

Let me know if that works.