Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter robskrob

    (@robskrob)

    Ok I got an answer to this here https://wordpress.stackexchange.com/a/378254/135177

    Thread Starter robskrob

    (@robskrob)

    Hi @robert681 thank you for your reply.

    Just to be clear — when someone signs into the wordpress dashboard and creates two factor authentication for their account using the whitesecurity 2FA wordpress plugin, the plugin redirects the user by default to the network page whose path is /wp/wp-admin/network/. At least, this has been my experience in using your plugin and setting up wordpress uses with 2FA.

    In my wordpress app, I have set it up such that only the super admins and administrators have access to the network page. Therefore, when either an Editor, Author, Contributor or Subscriber signs into the wordpress admin and after setting up their account with two factor authentication with the whitesecurity 2FA wordpress plugin, wordpress shows these users a page that says, “sorry, you are not allowed to see this page.” because the plugin, as stated above, redirects them to the network page, from which I have blocked them. I only need super administrators to view the network page.

    The solution I came up with is the following. I use the admin_init hook to redirect users away from the network page and to the wordpress dashboard only if the current page is the network one and they are not a super admin:

    add_action('admin_init', function() {
      // Only allow super admin to view network settings page
      if ( is_network_admin() && !(is_super_admin())) {
        wp_redirect("/wp/wp-admin/");
        exit;
      }
    });

    This allows the whitesecurity 2FA plugin to redirect users to the network page after setting up 2FA while not creating a weird / broken experience for my users who are not allowed to view that page.

    • This reply was modified 5 years, 11 months ago by robskrob.
    • This reply was modified 5 years, 11 months ago by robskrob.
    • This reply was modified 5 years, 11 months ago by robskrob.
Viewing 2 replies - 1 through 2 (of 2 total)