Forum
Page visible to members or redirect
I'm new to Perch and have looked at the docs but I can't find an answer to this. Using the Members app, I need a page that is only visible to logged in members. ie:
if (perch_member_logged_in()) = show content
else = redirect to url
or
if (perch_member_has_tag('subscriber')) = show content
else = redirect to url
Thanks
Hello Colin,
You can use
PerchSystem::redirect()
:Hi Colin
Welcome to Perch! You can check and redirect to another page if a member is not logged in – NB this must go above anything else on your page template as it uses a header redirect.
You could make that more complex by adding in a tag check too like
if (!perch_member_logged_in() && !perch_member_has_tag('guest'))
Ha ha - snap Hussein!
Perfect - thanks