Project: Limit a user ONLY to Blogs he is a Member of (Multisite)
-
Okay, so like some of you, I find the basic multisite privacy a bit lacking and would like things to be a bit more like a walled garden.
Although I have made my subdomains private and use Join My Multisite in order to have members join only one particular blog, I still feel there’s more to be done. Namely, a user of any network site can STILL view a site he isn’t “technically” a member of.
So, in order to do that, I’m proposing a bit of an open source project here on the boards.
The basic structure of the plugin/code would work like this:
-Check to see if the blog the user is attempting to view is one of the users blogs (As determined by
get_blogs_of_current_user()
.
–IF the user is a member of that site, allow them to view it.
–ELSE extract the$path
from the URL and attach it to the first blog$domain
in the array created byget_blogs_of_current_user()
.
—IF that generates page does not exist, append the$path
to each of the remaining blogs, in order, until you reach one that does generate a legitimate URL.
—-wp_redirect to the first valid url.
—–IF there is still no valid URL, redirect to the home domain of the first blog in the user’s list.*Also, there may be some opportunities to echo some error messages based as well to tell the user why they’re being redirected*
I’ll be working on this a bit over the next two to four weeks, and will be sharing my code as I go, but anyone else is free to jump on and modify and build and add code to their heart’s content. It’s a challenge, but that’s what I thought would make this such a fun project.
Thoughts?
-Nick
- The topic ‘Project: Limit a user ONLY to Blogs he is a Member of (Multisite)’ is closed to new replies.