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

    (@airadev1129)

    I need to require login to /design-editor/

    Here is my code:

    /**
     * fix custom login, remove redirects
     */
    function my_login_page( $login_url) {
        return site_url( '/my-account/');
    }
    add_filter( 'login_url', 'my_login_page', 10, 2 );
    
    /**
     * Bypass Force Login to allow for exceptions.
     *
     * @param bool $bypass Whether to disable Force Login. Default false.
     * @return bool
     */
    function my_forcelogin_bypass( $bypass ) {
      // Allow all WooCommerce pages and endpoints
      if ( class_exists( 'WooCommerce' ) ) {
        if ( is_woocommerce() || is_wc_endpoint_url() ) {
          $bypass = true;
        }
      }
      
    // page
        if ( is_page( array( 'home', 'terms-privacy', 'affiliate-disclosure', 'blog' ) ) ) {
        $bypass = true;
      }
      
    
    // blogpost
        if ( is_single() ) {
        $bypass = true;
      }
    
      return $bypass;
    }
    add_filter( 'v_forcelogin_bypass', 'my_forcelogin_bypass' );
    • This reply was modified 3 years, 4 months ago by airadev1129.
    Plugin Author Kevin Vess

    (@kevinvess)

    Hi, thanks for using Force Login!

    I recommend you hire a web developer to help you customize this for your site.

    Unfortunately, I’m unable to help troubleshoot these particular customization issues. It will be difficult for me to troubleshoot your code without access to your site and the hosting environment.

    With that being said, I suspect your issue is related to the bypass code allowing access to any WooCommerce page or endpoint?

    // Allow all WooCommerce pages and endpoints
    if ( class_exists( 'WooCommerce' ) ) {
      if ( is_woocommerce() || is_wc_endpoint_url() ) {
        $bypass = true;
      }
    }

    Good Luck!

    Thread Starter airadev1129

    (@airadev1129)

    I suspect your issue is related to the bypass code allowing access to any WooCommerce page or endpoint

    Thank you for your response.
    Even I remove the Woocommerce bypass, it is still not being blocked and according to the Force Login description, it is supposed to block all by default.

    Could this be a bug?

    Plugin Author Kevin Vess

    (@kevinvess)

    I don’t believe this is an issue with Force Login, but if you’re able to identify a bug in my code–?I’d be happy to review it.

    It’s possible Force Login is not compatible with this “lumise” plugin you’re using, but that doesn’t mean Force Login is flawed.

    Force Login runs it’s logic at the template_redirect hook, to do a redirect with full knowledge of the content that has been queried.

    Maybe your other plugin is also hooking into that action to do something which is causing Force Login to not run?

    I recommend you hire a web developer to help you troubleshoot this for your site.

    If you do find a solution to your issue, please add it here in case it’s helpful to someone else.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘not able to block lumise’ is closed to new replies.