I am trying to set up a multisite intranet (using subdomains) where content on each sub-site is only accessible to users logged into their respective site. The problem I am having is trying to restrict access to uploaded files (e.g. http://example.org/wp-content/uploads/2011/12/dummy.pdf) to logged in users only.
Similar to How to Protect Uploads, if User is not Logged In?, how would I enable one of the solutions proposed by hakre or Frank Bueltge for a multisite installation?
I have been scouring the net and Wordress Answers but havenât managed to find something that I can get to work. Related answers are:
Also, I am new to PHP and still learning how WordPress works under the hood, so detailed information about what I need to do and what goes where would be much appreciated.
Thanks!
Nice Question!
Poking around it a little bit, this seems to be working (further tests and a more qualified look are much welcome:). Tested only in a localhost development install with subdomains. No domain mapping.
Change the following
.htaccess
rewrite rule:Make a copy of
/wp-includes/ms-files.php
and place it on the root with the namedl-files.php
.Disable
SHORTINIT
, modify thewp-load.php
path and add acurrent_user_can()
check at the very beginning, so it becomes:Note that removing the
SHORTINIT
increases loading time and memory consumption. Read somewhere that it could be a ten fold increase (!?).Interesting discussions in wp-edu list (haven’t found nothing in wp-hackers):