• Resolved Rbbiz

    (@rbbiz)


    Hi,

    Thanks for creating this plugin. I really love it.

    The only thing that I can’t figure out is the whitelist option. I have a WordPress multisite. I’m trying to white list https://shop.easyorange.nl/dealers and entered the following to my functions.php.

    Caution: I am an absolute noob when i comes to code…

    /**
    * Filter Force Login to allow exceptions for specific URLs.
    *
    * @return array An array of URLs. Must be absolute.
    **/
    function my_forcelogin_whitelist( $whitelist ) {
    $whitelist[] = (‘https://shop.easyorange.nl/dealers’);
    $whitelist[] = (‘www.drinkflesgroothandel.nl/easyorangeshop/dealers’);
    return $whitelist;
    }
    add_filter(‘v_forcelogin_whitelist’, ‘my_forcelogin_whitelist’, 10, 1);

    I also tried:
    $whitelist[] = site_url( ‘/dealers/’ );

    Both with no effect. I keep getting the login screen.

    Thank you in advance for your help!

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

    (@kevinvess)

    Hi, I’m glad you like my plugin!

    Your code was very close. Try the first snippet you pasted but without the parentheses and make sure the URL path is absolute (including ‘https://’):

    /**
    * Filter Force Login to allow exceptions for specific URLs.
    *
    * @return array An array of URLs. Must be absolute.
    **/
    function my_forcelogin_whitelist( $whitelist ) {
      $whitelist[] = 'https://shop.easyorange.nl/dealers';
      $whitelist[] = 'https://www.drinkflesgroothandel.nl/easyorangeshop/dealers';
      return $whitelist;
    }
    add_filter(‘v_forcelogin_whitelist’, ‘my_forcelogin_whitelist’, 10, 1);

    Also, instead of using the site_url() function, you could try the network_site_url() function since this is for a multisite install.

    However, you may be better off with the first whitelist example you pasted because the network_site_url() function might whitelist the path “/dealers/” for all of your network sites; unless you wrap it in a conditional statement to only whitelist that URL for a specific site.
    https://codex.www.ads-software.com/Function_Reference/network_site_url

    • This reply was modified 8 years, 2 months ago by Kevin Vess. Reason: fixed code example and tweaked description
    Plugin Author Kevin Vess

    (@kevinvess)

    Also, when you whitelist a URL, you may need to include a trailing slash at the end. For example:

    $whitelist[] = 'https://shop.easyorange.nl/dealers/';

    Thread Starter Rbbiz

    (@rbbiz)

    Seems to work like a charm :-). Thanks so much. Will leave a review!

    Plugin Author Kevin Vess

    (@kevinvess)

    Thanks! I’m glad we were able to get it working. Enjoy!

    Thread Starter Rbbiz

    (@rbbiz)

    The craziest thing happened overnight. The first URL that I white listed suddenly doesn’t get white listed any more…

    Current code, which was working 24 hours ago:

    /**
    * Filter Force Login to allow exceptions for specific URLs.
    *
    * @return array An array of URLs. Must be absolute.
    **/
    function my_forcelogin_whitelist( $whitelist ) {
    $whitelist[] = 'https://shop.easyorange.nl/dealers/';
    $whitelist[] = site_url( '/bedankt-voor-je-aanvraag/' );
    $whitelist[] = site_url( '/mijn-account/lost-password/' );
    
    return $whitelist;
    }
    add_filter('v_forcelogin_whitelist', 'my_forcelogin_whitelist', 10, 1);

    URL 2 and 3 are white listed. If I change the first URL to the same form as the second two it does not work.

    Weird science.. help would be appreciated!

    • This reply was modified 8 years, 2 months ago by Rbbiz.
    Plugin Author Kevin Vess

    (@kevinvess)

    The code you pasted looks correct –?has anything else changed since you last tested if this was working? Have you installed or updated any other plugins?

    You might want to try enabling WP_DEBUG mode to see if your site is throwing any errors.
    https://codex.www.ads-software.com/WP_DEBUG

    Thread Starter Rbbiz

    (@rbbiz)

    I did both version with site_url and full url, now it works. Pretty weird…

    Thread Starter Rbbiz

    (@rbbiz)

    Okay, new day. Same problem. Getting pretty frustrated… how is this possible?

    Plugin Author Kevin Vess

    (@kevinvess)

    Have you tried enabling WP_DEBUG mode to see if your site is throwing any errors?
    https://codex.www.ads-software.com/WP_DEBUG

    If the site is throwing errors, try fixing those first.

    Or, maybe there is a conflict with another plugin or your theme?

    To test for a theme conflict:

    1. Activate default Twenty Eleven, Twelve, Thirteen, or Fourteen theme
    2. Check to see if the issue still occurs
    3. If the issue does not occur after having activated the default “Twenty” theme, your theme is causing a conflict with Force Login.

    To test for a plugin conflict:

    1. Deactivate ALL plugins
    2. Activate Force Login
    3. Check to see if the issue occurs

    If the issue does not occur, one (or more) of your plugins is causing a conflict with Force Login.

    To determine which plugin(s) is causing the conflict, follow these steps:

    1. Activate each plugin one by one
    2. Check to see if the issue occurs after each plugin is activated
    • This reply was modified 8 years, 2 months ago by Kevin Vess.
    Thread Starter Rbbiz

    (@rbbiz)

    The thing is it only happens with one url, all others work perfect… any thoughts on that? Do you also do programming work? Wouldn’t mind to pay for you to research it further? Thanks in advance.

    Plugin Author Kevin Vess

    (@kevinvess)

    I am a web consultant by trade and I could look into it further if you like.

    Send me a message on Slack @kevinvess to get into the details of your website. Thanks!

    • This reply was modified 8 years, 2 months ago by Kevin Vess.
    • This reply was modified 8 years, 2 months ago by Kevin Vess.
    • This reply was modified 8 years, 2 months ago by Kevin Vess.

    That was it. It was this pile of dong plugin ‘login-page-styler-premium’ also goes by ‘theme-my-login.6.4.6’ Developer wanted $100 to fix his scam.

    Once turned off, everything works as it should. Thanks!

    Please disregard this comment. There is nothing wrong with theme-my-login. I got the two confused. Responded to you on the correct forum. Not sure how I was directed here from the email.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Whitelist for dummies’ is closed to new replies.