• Resolved jboone2000

    (@jboone2000)


    I love your plugin! I have a primary product site and a supporting content site on which force-login is installed to secure the content from general internet users. Is there a way to allow force login to ignore (whitelist) any page request from the primary product site.

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

    (@kevinvess)

    Thanks for using Force Login – I’m glad you love it!

    Yes, you could allow exceptions for visitors coming from any page from your primary product site by using the v_forcelogin_bypass filter.

    You just need to figure out how you’re going to identify where the visitor came from to then bypass Force Login. You could for example, use the $_SERVER['HTTP_REFERER'] variable.

    /**
     * Bypass Force Login to allow for exceptions.
     *
     * @return bool Whether to disable Force Login. Default false.
     */
    function my_forcelogin_bypass( $bypass ) {
      if ( 'http://www.domain.com/' === $_SERVER['HTTP_REFERER'] ) {
        $bypass = true;
      }
      return $bypass;
    }
    add_filter('v_forcelogin_bypass', 'my_forcelogin_bypass', 10, 1);

    Keep in mind though, the $_SERVER['HTTP_REFERER'] is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.

    http://php.net/manual/en/reserved.variables.server.php

Viewing 1 replies (of 1 total)

The topic ‘Allow access from a specific site’ is closed to new replies.