0

I have a template where I only want "Members" to be able to access. If a user that is not part of the "Members" group tries to access that page, I want it to redirect to a sign-up/index

Here is what I did in the templates

enter image description here

However, my problem is that when I tried accessing this certain template as "Guest", I only see a blank page. I am not redirected to sign-in/index.

Am I missing something here?

2

When you use template access restrictions, EE doesn't do a browser redirect to your no-access template (sign-in/index)--it just displays that template in-place.

For example, if you browse to /members-only in your browser and that's a template with the access restriction, EE will display the sign-in/index template at the /members-only URL.

So, first of all, make sure that you see what you want when you browse to /sign-in in your browser -- make sure that's not blank. Also be sure that you don't have any conflicting template access restrictions on sign-in/index!

Then, if that's OK, check that your code in sign-in/index can adapt to the different URLs where it will be displayed.

Does any of that help?

2
  • I see. So it just replaces what it shows, not redirect. In other to redirect, I have to use conditionals in the template and use {redirect}, right? – developarvin Feb 19 '14 at 5:22
  • You can do access restrictions totally with conditions--I like to do this with the IfElse and HTTP Header add-ons: {exp:ifelse parse="inward"} {if logged_out}{exp:http_header status="301" location="/register/login" terminate="yes"}{if:else}... Or, you can use the EE Template Access Restrictions, and then have EE point to an "unauthorized" page that's just a redirect to your sign-in page, e.g., {redirect="sign-in/index"}. – Jay F Feb 19 '14 at 23:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.