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 ‘http://’):
/**
* 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[] = 'http://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.wordpress.org/Function_Reference/network_site_url
-
This reply was modified 6 years, 6 months ago by
Kevin Vess. Reason: fixed code example and tweaked description
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!
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 6 years, 6 months ago by
Rbbiz.
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.wordpress.org/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?
Have you tried enabling WP_DEBUG mode to see if your site is throwing any errors?
https://codex.wordpress.org/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:
- Activate default Twenty Eleven, Twelve, Thirteen, or Fourteen theme
- Check to see if the issue still occurs
- 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:
- Deactivate ALL plugins
- Activate Force Login
- 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:
- Activate each plugin one by one
- Check to see if the issue occurs after each plugin is activated
-
This reply was modified 6 years, 6 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.
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 6 years, 6 months ago by
Kevin Vess.
-
This reply was modified 6 years, 6 months ago by
Kevin Vess.
-
This reply was modified 6 years, 6 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.