Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter rmalviya

    (@rmalviya)

    Thanks for your explanatory reply.

    As you’ve discovered yourself, $_SERVER['REQUEST_URI'] outputs / – which means at the time of when Force Login runs, it sees the root URL as what the user tried to visit.

    You’re right Kevin. After some debugging I found out that there was some other plugin which was redirecting the users to root when non-logged in users tried to access wp-admin.

    I also found out that there is nothing needs to be done to bypass the admin-post.php request while your plugin is active, which is great for plugin developers. I don’t need to put any bypassing or whitelisting logic for my request to work, it just works. Earlier it was not working because the another culprit plugin on site was redirecting the wp-admin request to home for non-logged in users and after that your plugin was trying to do its work i.e. asks for login via redirecting again.

    Thanks for your support. Keep doing good work.

    Thread Starter rmalviya

    (@rmalviya)

    Thanks for instant reply.

    I’m using your suggested v_forcelogin_bypass. The request is to admin-post.php and all the data is passed to it is through query parameters, so how can I check for any condition without getting any query parameters?
    For checking bypassing condition I need either the current url or the query parameters to it. Please suggest solution for this.
    Can you explain why it doesn’t get correct current url?

    Thread Starter rmalviya

    (@rmalviya)

    Thanks for your reply.

    Using v_forcelogin_bypass doesn’t make any difference either. The problem is that I’m getting wrong url for the request in the hooked function for bypassing. I only get root url part and all after that is stripped out. So, how can I check if the current url is the url which I want to bypass. The code I tried:

    function my_forcelogin_bypass( $bypass ) {
        error_log( $_SERVER['REQUEST_URI'] );
        return $bypass;
    }
    add_filter( 'v_forcelogin_bypass', 'my_forcelogin_bypass' );

    When I make request to admin-post.php, this outputs / in my debug.log file instead of expected path to admin-post.php. Please help.

    • This reply was modified 7 years, 10 months ago by rmalviya.
    • This reply was modified 7 years, 10 months ago by rmalviya.

    The issue is still not resolved. The custom plugins can’t post to admin-post.php

Viewing 4 replies - 1 through 4 (of 4 total)