• Resolved bluemuse

    (@bluemuse)


    Hi,

    I’m using a plugin (user meta pro) to create a custom login and registration page and using a single url protection in functions.php and this is working fine.

    What I would like to do, is to use wordpress password protection for the custom register page so that only people with the password can register, however even though a visitor can see the password protected page without being login (which is what I want them to do) when the password for the page is entered they are getting re-directed to the login page.

    Is there an exception for this scenario?

    thanks

    https://wordpress.org/plugins/wp-force-login/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Kevin Vess

    (@kevinvess)

    a visitor can see the password protected page without being login (which is what I want)

    I assume this is because you’ve whitelisted that page URL?

    Can you share the code you used to whitelist this page?

    when the password for the page is entered, they are getting re-directed to the login page.

    Is the URL different for both the password protected page and after the page after the password has been entered?

    Have you checked if the URL that is added to the login screen to redirect to after logging-in is the same URL as the password protected page you’ve already whitelisted?

    For example: http://domain.com/wp-login.php?redirect_to=

    Thread Starter bluemuse

    (@bluemuse)

    Hi,

    Below is code I used:

    /**
     * Filter Force Login to allow exceptions for specific URLs.
     *
     * @return array An array of URLs. Must be absolute.
     **/
    function my_forcelogin_whitelist( $whitelist ) {
      $whitelist[] = site_url( '/login/' );
      $whitelist[] = site_url( '/register/' );
      return $whitelist;
    }
    add_filter('v_forcelogin_whitelist', 'my_forcelogin_whitelist', 10, 1);

    With force login turned off, the url of the page is the same before and after, when force login is on it is getting re-directed to the ‘/wp-login.php?action=postpass’ URL

    Plugin Author Kevin Vess

    (@kevinvess)

    After testing my plugin, I was able to whitelist a password protected page, enter the password and see the page content without any issues. It seems to be working for me.

    it is getting re-directed to the ‘/wp-login.php?action=postpass’ URL

    After some quick searches on Google, I found many other people experiencing a similar issue to yours with other plugins and themes.
    https://www.google.com/#q=wordpress+action%3Dpostpass

    https://wordpress.org/tags/postpass

    It seems to be related to when plugins or themes use ‘the_password_form’ filter:
    https://wordpress.org/support/topic/password-protected-pages-17?replies=20#post-5073997

    I don’t believe this is caused by my plugin – I suspect it has to do with either your User Meta Pro plugin or your theme.

    Thread Starter bluemuse

    (@bluemuse)

    Hi Kevin,

    I found the resolution on the user meta pro forum, if anyone else has this problem this is the fix:

    In /wp-content/plugins/user-meta/controllers/pro/umPreloadsProController.php on line 153 I changed this:

    if( !empty( $login[ 'login_page' ] ) && !empty( $login[ 'disable_wp_login_php' ] )){
    wp_redirect( get_permalink( $login[ 'login_page' ] ) );
    exit();
    }

    To this:

    if( !empty( $login[ 'login_page' ] ) && !empty( $login[ 'disable_wp_login_php' ] ) && $_GET['action'] != 'postpass'){
    wp_redirect( get_permalink( $login[ 'login_page' ] ) );
    exit();
    }

    And this fixed it. Hopefully someone else benefits from this as well.

    Plugin Author Kevin Vess

    (@kevinvess)

    Great! I’m glad you were able to resolve your issue with the User Meta Pro plugin. And thanks for sharing your solution!

    Be sure to rate and review my plugin to let others know how you like it; enjoy!

    Thread Starter bluemuse

    (@bluemuse)

    Sure thing Kevin.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Whitelist a single password protected page’ is closed to new replies.