Title: Multisite?
Last modified: June 9, 2017

---

# Multisite?

 *  Resolved [angrywarrior](https://wordpress.org/support/users/angrywarrior/)
 * (@angrywarrior)
 * [9 years ago](https://wordpress.org/support/topic/multisite-430/)
 * Hello [@helgatheviking](https://wordpress.org/support/users/helgatheviking/) !
 * Does your plugin software work well/compatible with WordPress Multisite?
 * Thanks a bunch for your answers. 🙂
 * Kind regards
    AngryWarrior

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/multisite-430/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/multisite-430/page/2/?output_format=md)

 *  Plugin Author [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * (@helgatheviking)
 * [9 years ago](https://wordpress.org/support/topic/multisite-430/#post-9212787)
 * I believe so, but I don’t know for sure. Please test and let me know.
 *  Thread Starter [angrywarrior](https://wordpress.org/support/users/angrywarrior/)
 * (@angrywarrior)
 * [9 years ago](https://wordpress.org/support/topic/multisite-430/#post-9213579)
 * Alright, thank you for your quick response and have a wonderful weekend!
 * Cheers! 🙂
 *  Plugin Author [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * (@helgatheviking)
 * [9 years ago](https://wordpress.org/support/topic/multisite-430/#post-9213621)
 * Same to you! Please do let me know what you find out. I believe it should work
   fine for each sub-site.
 *  Thread Starter [angrywarrior](https://wordpress.org/support/users/angrywarrior/)
 * (@angrywarrior)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/multisite-430/#post-9306827)
 * Hi [@helgatheviking](https://wordpress.org/support/users/helgatheviking/) !
 * Thanks a bunch for your answers!! 🙂
 * Sorry for my very slow response! (been quite busy)
 * I might ask you nicely while i have you on the line..
    Any update planned soon
   btw? The plugin is getting bit old by now..(seven months+..
 * **In regards to WPMU..:**
    I have it running on a few sub-sites and so far it
   seems to work. I have not network activted it. But per website…
 * Cheers! 🙂
 *  Plugin Author [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * (@helgatheviking)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/multisite-430/#post-9307943)
 * Well that’s good to hear. There are no planned updates since the plugin is still
   working just fine for most people. If it ain’t broke….
 *  Thread Starter [angrywarrior](https://wordpress.org/support/users/angrywarrior/)
 * (@angrywarrior)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/multisite-430/#post-9308126)
 * Thank you [@helgatheviking](https://wordpress.org/support/users/helgatheviking/)!
 * I wish you a wonderful day.
 * Cheers!
    AngryWarrior
 *  [Fiech](https://wordpress.org/support/users/fiech/)
 * (@fiech)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/multisite-430/#post-9389024)
 * Hi [@helgatheviking](https://wordpress.org/support/users/helgatheviking/) ,
 * I just tested your plugin, and unfortunately, it does not differentiate between
   users of different sites in a multi site installation. So any logged in user (
   of the respective access level) of any site can see any restricted navigation
   entry.
 * Is this a desired behavior? If not, is this something that can be fixed?
 * Best,
    Fiech
    -  This reply was modified 8 years, 10 months ago by [Fiech](https://wordpress.org/support/users/fiech/).
 *  Plugin Author [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * (@helgatheviking)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/multisite-430/#post-9389351)
 * It isn’t desired, it’s just I don’t know that much about multi-site. It appears
   I may need to user `current_user_can_for_blog()` instead of `current_user_can()`
   here: [https://github.com/helgatheviking/Nav-Menu-Roles/blob/master/nav-menu-roles.php#L464](https://github.com/helgatheviking/Nav-Menu-Roles/blob/master/nav-menu-roles.php#L464)
 * I’m open to pull requests if you want to look into it, otherwise I won’t have
   the time to look into this until possibly September.
 *  [Fiech](https://wordpress.org/support/users/fiech/)
 * (@fiech)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/multisite-430/#post-9389424)
 * Hey, thanks for the quick reply.
 * Ok, so I looked into it a bit, and I have to correct myself: If I select a minimum
   role, it works as desired, because `current_user_can()` already only looks up
   the current blog.
 * The problem occurs, if one only selects “Logged in” as a requirement. Depending
   on whether this is a desired behavior, it can be easily fixed by changing [line 455](https://github.com/helgatheviking/Nav-Menu-Roles/blob/master/nav-menu-roles.php#L455)
   to:
 * `$visible = ( is_user_logged_in() && is_user_member_of_blog() ) ? true : false;`
 * I don’t know, if this warrants a PR, but I can open one, if you prefer.
 *  Plugin Author [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * (@helgatheviking)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/multisite-430/#post-9389447)
 * Well that’s great. What happens with `is_user_member_of_blog()` when *not* a 
   multisite? Is there anything that needs to happen when “logged out” is selected?
 * Should
 *     ```
       $visible = ! is_user_logged_in() ? true : false;
       ```
   
 * become
 *     ```
       $visible = ! is_user_logged_in() || ! is_user_member_of_blog() ? true : false;
       ```
   
 * If you can clear that up, I can probably push an update without a PR.
 *  [Fiech](https://wordpress.org/support/users/fiech/)
 * (@fiech)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/multisite-430/#post-9389519)
 * Ok, I did some further testing:
 * a) The code and the changes all work as expected in a single site installation
   too.
 * b) You’re right about the logged-out case. There, the fix is also needed because
   otherwise users from different blogs won’t see external links, when logged in.
 * c) The function `current_user_can()` in line 464 respects super-admin rights.
   So to make this consistent with the logged-in/logged-out parts, you’ll need the
   following fixes:
 * line 455: `$visible = $visible = is_user_logged_in() && ( is_user_member_of_blog()
   || is_super_admin() ) ? true : false;`
 * line 458: `$visible = ! is_user_logged_in() || ! is_user_member_of_blog() && !
   is_super_admin() ? true : false;`
 *  Plugin Author [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * (@helgatheviking)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/multisite-430/#post-9389666)
 * Doesn’t `is_user_logged_in()` return true if the super admin is logged in? So
   is the check for super admin necessary?
 *  [Fiech](https://wordpress.org/support/users/fiech/)
 * (@fiech)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/multisite-430/#post-9390987)
 * The thing is, with the fix, the user has additionally be a member of the current
   blog. But `is_user_member_of_blog()` does not return automatically true for super
   admins. OTOH `current_user_can()` will return true for super admins in every 
   case.
 * But you can streamline the code, because both `is_user_member_of_blog()` as well
   as `is_super_admin()` return false (surprise, I know, but I checked for errors,
   nonetheless), if current user is not logged in at all.
 * So, you can simplify the code:
 * line 455: `$visible = is_user_member_of_blog() || is_super_admin() ? true : false;`:
 * For the logged in condition to work, the user has to be a logged in member of
   the current blog or be a logged in super user.
 * line 458: `$visible = ! is_user_member_of_blog() && ! is_super_admin() ? true:
   false;`:
 * For the logged out condition to work, the user has to be either logged out or
   not be a member of of the current blog. But they also may not be a super admin,
   because logged in super admins should see the internal stuff, not the external.
 * This would be consistent with the code in lines 461-467, where current_user_can()
   always returns true for super admins.
 * I also checked this code to work with a non-multi site installation.
 *  [Fiech](https://wordpress.org/support/users/fiech/)
 * (@fiech)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/multisite-430/#post-9515442)
 * Coming back to it: Should I put up a pull-request on the weekend?
 *  Plugin Author [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * (@helgatheviking)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/multisite-430/#post-9518595)
 * Please do. I don’t know quite when I’ll get to check it out, but I will eventually.
   Thanks!

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/multisite-430/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/multisite-430/page/2/?output_format=md)

The topic ‘Multisite?’ is closed to new replies.

 * ![](https://ps.w.org/nav-menu-roles/assets/icon-256x256.png?rev=2336319)
 * [Nav Menu Roles](https://wordpress.org/plugins/nav-menu-roles/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nav-menu-roles/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nav-menu-roles/)
 * [Active Topics](https://wordpress.org/support/plugin/nav-menu-roles/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nav-menu-roles/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nav-menu-roles/reviews/)

 * 17 replies
 * 4 participants
 * Last reply from: [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * Last activity: [8 years, 7 months ago](https://wordpress.org/support/topic/multisite-430/page/2/#post-9635497)
 * Status: resolved