• Resolved oobertus

    (@oobertus)


    Hey

    I am currently struggeling to configure the plugin to prevent not logged in users to see my content (pages and posts) but allow them to log in or register.

    When I activate “Prevent site access to visitors” the site redirects to the login page. But this site is also not accessible which leads to a “too many redirects” error…

    I am clueless how to configure it correctly. Please help ??

    Robert

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter oobertus

    (@oobertus)

    After looking into the code I found that this is a bug in the plugin.

    Problem is: My wordpress instance runs in a subfolder of the domain “www.xyz.org/myWebsite”. The plugin checks for matching urls in “includes/actions.php” line 455 ($url === $registration_page) and 463 ($url === $allowed_url) but $url contains the “myWebsite” part twice (“www.xyz.org/myWebsite/myWebsite/register.php”)

    This is becaus $url is build from “home_url( $url_part );” (line 432) which adds “myWebsite/register.php” to “www.xyz.org/myWebsite”

    Happy to hear when this is fixed. Until then I use a modified version of the plugin…

    Robert

    Plugin Author WP User Manager

    (@wpusermanager)

    Thanks for the report, and apologies for the issue. I’ve raised the issue and we’ll get it fixed for the next version https://github.com/WPUserManager/wp-user-manager/issues/357

    Thread Starter oobertus

    (@oobertus)

    I’ve got another problem regarding this feature… I have switched to another server to implement the same behavior. Here I have installed inside the root directory. Server runs PHP 8.

    The variable “url_part” returns empty because “filter_input” seems not to work. Current workaround is to use “filter_var($_SERVER[‘REQUEST_URI’],FILTER_UNSAFE_RAW, FILTER_NULL_ON_FAILURE);” instead of “filter_input( INPUT_SERVER, ‘REQUEST_URI’ );” (line 426 in includes/actions.php)

    regards, Robert

    Plugin Support Mark Kevin

    (@mkesteban08)

    Hi @oobertus ,

    This is Mark from the WPUM support team.

    As of now, the team is actively working on making the plugin completely compatible with?PHP?version?8?and above. Could you please let me know if this is the same set up that you have for the other site?

    Thanks for your kind understanding, and let me know if you have other questions, I’ll be glad to help you with them.

    So we had the same issues where activating that option would result in a redirect loop. The problem seems to come from line 426:

    $url_part = filter_input( INPUT_SERVER, 'REQUEST_URI' );

    The $url_part is always empty and would result in an unending loop

    If I use

    $url_part = $_SERVER['REQUEST_URI'];

    It will work.

    The previous solution provided using filter_var doesn’t seem to work, so this is a temporary fix for now.

    • This reply was modified 2 years, 1 month ago by pinonon.
    Studiobovenkamer

    (@studiobovenkamer)

    Experiencing the same redirect loop on the log-in page. Running PHP 8.0.8. Locally, WP is installed in the root directory (not a subdirectory).

    We don’t experience this issue on the live/hosting server which has PHP 8.0.28 installed.

    Running version 2.9.5 of WP User Manager

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Prevent site access to visitors but allow them to log in’ is closed to new replies.