My multisite install was working fine until recently. I have two pages behind a "logged-in group" in the "sub-site" that can no longer be accessed. They reroute to the homepage. The same setup (same pages / same group privileges) continues to work fine. The two pages are viewable as soon as I removed the access restriction.
Sorry, I've re-read your question several times and it seems to say something doesn't work (restricted pages re-route to homepage), but the same thing ("same setup") "continues to work fine", and I'm not sure what to make of that.
Could you please clarify.
In any case, I'd say we likely need access to your site network to be able to look at your set up and to see what's going on, if that's okay.
Let me mark your next reply as private so that we can get log-in credentials from you—you may want to create a temporary admin user for us to use that you can later delete. And be sure to have a current backup of your site.
Can you also confirm where we can see the problem.
During initial troubleshooting, I couldn't find anything obvious on the website that could cause this redirection. Can you please check if any custom code is added in the active theme, which would affect these pages?
If you don't find any custom code, I'll need your permission to download a clone/snapshot of the website, to troubleshoot this in more depth, on a different server. This way the actual website won't be affected.
I do have some code in the function file but nothing new or unique to the sub-site. I tried to see what would happen with all the code disabled and did not get anything different. You have my permission to further troubleshoot on a different server.
As the website was part of a multisite network with a subdomain install, deploying its clone to a test server proved challenging. But, finally, I was able to reach the bottom of this.
The access posts group "Logged-in Users", is set to give 'Read' access to only specific user roles.
( screenshot: hidden link )
However, the test user that you shared with me (and probably the one that you were testing for yourself), doesn't have any of those user roles. This is why, if you'll create a new user with any of the allowed roles, you'll see that you'll be able to access those pages, just fine.
(I've even tested this with a temporary user on your website, which is now deleted)
Note: A "Superadmin" user is a special exceptional type of user role only for multisite. So for general access control testing, it is a good idea to use an "Administrator" level user role instead.
Thanks, Waqar. I did test with a 'normal' user and was able to reach the two 'problem pages' in sub site. However, the 'post event' page gets numerous warnings:
Warning: array_map(): Expected parameter 2 to be an array, null given in .../wp-content/plugins/types/vendor/toolset/toolset-common/toolset-forms/classes/class.conditional.php on line 325
Warning: array_unique() expects parameter 1 to be array, null given in .../wp-content/plugins/types/vendor/toolset/toolset-common/toolset-forms/classes/class.conditional.php on line 326
Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in .../wp-content/plugins/types/vendor/toolset/toolset-common/toolset-forms/classes/class.conditional.php on line 327
I am still confused why the existing super-admin settings/roles continue to work in the main site (same logged user settings and same 'dashboard' page) and stopped working in the sub. I had made no changes to user roles when it stopped working a couple of weeks ago.
Thanks for the update and glad that it is sorted now.
During further troubleshooting, I found that the errors and warnings on the 'post event' page were being caused by the incomplete condition set for the custom field "Location", in the field group "Field Group for WOAW Activities Entries".
You can complete or remove that condition from that field's settings and those errors/warnings will be fixed.
( screenshot: hidden link )
I see a number of third-party plugins on the website, including "WordPress Multisite User Sync/Unsync", to sync users across the multisite network. It would be difficult to say for sure what changes have been made to the website through these plugins from a couple of weeks ago. But, at least now we have an understanding that "Superadmin" role users are treated differently.
Thank you, Waqar. I am not sure that it was just a 'super admin' issue since everything including the permissions were done a while ago and everything was working since. But the 'super admin' users did have a 'community' role previously and somehow were bumped out of that and into generic 'subscriber' roles with no community access. I had not noticed that until you pointed out the permission issue. 'Super Admin' were the only users bumped out of a 'community' role and into a generic 'subscriber' role. Something must have triggered it indeed.
It is still interesting that Access treats a 'super admin' as an 'admin' in the main site but not in the sub site. The 'super admin' was enough to supersede the lack of community privilege in the main site and prevent access problems. Bizarre. Regardless, I have granted 'admin' roles to 'super admin' users in each site just to make sure that access stays happy but I'll keep an eye on 'automatically bumped roles'.
Thanks for pointing out the location conditional issue. I'll dig into that and open a new thread if I have problems resolving it.