• Hi,

    I am using the authorizer_has_access filter in functions.php to validate that a user is in a list of valid users to access a certain page of my website. If the user is logged in but is not in the list, I set has_access to false in the function that is called for the authorizer_has_access filter. I can see that my function is working correctly (based on printing to screen) in the function to determine whether the user should have access to the page, and it works correctly when has_access is set to true, to continue to show the page, but when has_access is false, I am getting a browser error ERR_TOO_MANY_REDIRECTS. I had thought either the plugin would redirect to a certain page (how do I specify what page?), or it would show an error message that you do not have access to view this page.

    Is there another step I need to do to configure what happens when the user is logged in but does not have access to a page? I checked the Authorizer settings for anything like a page to show when access is denied, or a message to show, etc. and don’t see anything.

    Thank you,

    Colleen

Viewing 1 replies (of 1 total)
  • Plugin Author Paul Ryan

    (@figureone)

    Hm, strange. Yes that should work. The behavior should be controlled in “Authorizer Settings > Public Access > What happens to people without access when they visit a private page?”

    The options are to redirect to the login screen (wp-login.php), or render the message. If you have it configured to redirect to login, can you try the other option? Perhaps you have another plugin changing the value of wp_login_url() and that’s causing the hook to fire again and deny access to that page as well.

    https://developer.www.ads-software.com/reference/functions/wp_login_url/

Viewing 1 replies (of 1 total)
  • The topic ‘If has_access = false in authorizer_has_access’ is closed to new replies.