It sounds like keeping the re-direction is essential, otherwise activity posts could be shared across sites.
I will instead just put a note on the no-login page to advise them to clear browser cache if they wish to try logging in again after contacting subsite Admin for membership.
Thanks for your help.
Let me know steps forward to reimburse you as discussed.
Oh, actually there is a problem with the redirection…. Once I have been redirected, I cannot go back to the subsite login page. I am assuming this is due to a cookie. As a result, I do think it would just be simpler to remove redirection all together. So long as the non-member cannot access the subsite, that’s all that matters.
It all seems to be working great now.
Yesterday (before we removed your code due to roll back), no visitors could even see the subsite’s login page because it immediately directed everybody to the no-login page.
This time round, all visitors can see the login page, as expected. Members can log in but non-members (who are registered elsewhere on the network) are redirected to the no-login page. Great. Unregistered visitors (who don’t have a username or password but try anyway) just remain on the login page without passing through, as expected.
So thanks again. I am now looking for a way to add the troubleshooting fee to a shopping cart so I can pay the USD$50 but I don’t see it – just a contact form on the troubleshooting page. Please advise.
Also, in case I have to roll-back to previous version in future (if there are any future plugin conflicts), I don’t want to lose your code. Is it all in the bp-custom.php file? (If so, I will just copy this to local drive as back up.) Or was code added elsewhere as well?
We have identified the conflict, which was a new caching and database-cleaning plugin called WP-Optimizer. It is now removed. The site has rolled back to a previous version. Your code to redirect visitors to primary site page is also removed and I actually prefer it that way. On the plus, it looks like the separate member tables is still in place. i.e. Members of the Hoodies subsite cannot see members from other sites on the multisite.
So just to clarify, my request is to not allow non-members to log in to sites. Only members can log into sites. (I know random visitors can’t log in because they are not on the network at all and do not have a password etc. But at the moment, anyone who is already a user of any site on the multisite network can log into any other subsite on the network, even if they are not members of that subsite.) Does that make sense?
Although you said the member tables are now separate between subsites, it seems that this hasn’t stopped members from being able to log into sites where they are not members, and this is a problem.
I appreciate you’ve probably logged off for a few hours but I wanted to let you know that there have been too many strange things going on with my multi-site today. The main issue is that some of the images aren’t coming back. We aren’t 100% sure it’s because of Elementor. It might also be a conflict with your new code, I don’t know. The only way to get the images back (aside from re-uploading and configuring them) is to roll to a back-up version. This will likely remove your code also, which I don’t mind because as noted above, it would be better if we did not put a redirection in place.
I would still like to make sure that (a) only members of the subsite can be seen on the subsite, meaning that the tables are separate for all subsites, and (b) network members cannot log into subsites that they are not members of.
Please let me know when you are back online. I will of course take a copy of the site before rolling back.