Thread:Project:Support desk/How to disable view source tab for anonymous users in mediawiki 1.20/reply (7)

And that are no hacks, but the API is intended to provide that information. You sure can turn the API off, however, as Rico says correctly: MediaWiki is not designed to hide the wiki source code of a page. If one wants to find a way to see it, there surely will be one.

After some thinking I have a better solution for the problem:

You say that you want to keep the button, but we also realized that having a button, which in fact is non-functional, does not make sense. In fact you only want the button to show the wiki source code, when the user is logged in; when he is not logged in, the logical function is to display the login page so that he can log in (when he has an account) in order to then edit pages. So if I were you, I would change the URL, which the button points to: If the user is not logged in, then change the URL to point to the Login page with the according parameters for the login page to return the user to the edit page after login succeeded.