Support » Networking WordPress » Redirect loop when user is logging in to a site without credentials

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    It appears the plugin isn’t compatible with Multisite

    https://wordpress.org/support/topic/multisite-redirect-2?replies=2

    What kind of ‘access’ are you trying to block? Do you want it so that someone who isn’t a member of Site A cannot even see it?

    https://wordpress.org/plugins/network-privacy/ may be what you want.

    Thread Starter Reuven.g

    (@reuveng)

    Thank you @mika
    Yes I am looking to make both sites only accessible for registered users and block access from users without the right roles.
    I do plan to create some custom roles for each site with different privileges.
    The problem is when a user is trying to view the site not having the right privileges to view it I get the redirect loop.

    From the activation of the plugin I see it is not giving me options to set different privileges for different users on the same site,
    It is working only if it is Network activated.
    If I activate it per site the Settings -> Privacy menu not appearing.

    I have made a different installation of the site and share the users and usersmeta tables.
    I changed the DB manually to comply with regular WP installation.
    ex.

    define('CUSTOM_USER_TABLE', 'pref_users');
    define('CUSTOM_USER_META_TABLE', 'pref_usermeta');

    One of them is on a subdomain so I have a similar behavior to the multiseuit.
    And I use the update_user_meta() function with the user_register action
    to set for the newly created user a role on the second blog.
    I know it’s a workaround but it is working the way I need it now.

    I am looking for the right action of filter to use update_user_meta() when updating a user in the user-edit.php page.
    So I will be able to set the users for both installations.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    WordPress Access Control is not compatible with Multisite so … yeah, you’re on your own there :/

    I do plan to create some custom roles for each site with different privileges.

    Those will always need to be per-site. User roles are managed by each site, so while users are drawn from the network list, the basics are that they’re ‘fake’ subscribers to all sites on all networks. They can comment, etc.

    What the plugin I linked to does is check if someone’s a member OF that site, and if not, they’re not allowed.

    In a WordPress network activated on an individual site adds the following privacy options:

    I would like my site to be visible only to Registered network users.
    I would like my site to be visible only to Site subscribers.
    I would like my site to be visible only to Site administrators.
    I would like my site to be visible only to Site contributors (and above)

    If you’re making additional roles, though, that shouldn’t be an issue.

    Thread Starter Reuven.g

    (@reuveng)

    I created roles on one site similar to “site1” “site2” and “both”.
    I made a small plugin and I use it on user_register action, to update the meta table.
    I use the update_user_meta' function and update the field of the shearedprefix_usermetatable to add a field ofprefix2_capabilitieswithmeta_value`of the $_POST[‘role’].
    this gives the user of site2 the ability to be updated by site1.
    that way both sites are updated simultaneously.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    You’d have to share your code if you want us to help you debug it. I suggest putting it up on Github or similar and linking so we can see what you’re doing.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Redirect loop when user is logging in to a site without credentials’ is closed to new replies.