Showing a different page to user depending on group [SOLVED]
Posted: Mon Feb 07, 2011 6:20 pm
Hi guys,
I have a situation in which I want to add groups x and y, check to see if a user is a member of any of those groups and if they are, direct them to a different page depending on which group they are a member of, i.e. Group X will be redirected to Page X, Group Y to Page Y and so on.
I realise that I could do that with several {if} statements in my template and {redirect}s but I really need it to continue working if I add more groups without having to edit the template every time to add new statements.
What i've done so far:
1. Created two users "User 1" and "User 2".
2. Created two groups "Group X" and "Group Y".
3. Assigned "User 1" to "Group X" and "User 2" to "Group Y".
4. Created two new pages, one for each user to see when they're logged in.
5. Added an extra attribute value to each of the pages, "Group X" and "Group Y".
6. Added the following code to the template i'm using for protected pages:
What happens is that the user is always shown the "Note Authorized" message, regardless of group membership.
I guess i'm on the wrong track here. Could someone give me some guidance please?
I have a situation in which I want to add groups x and y, check to see if a user is a member of any of those groups and if they are, direct them to a different page depending on which group they are a member of, i.e. Group X will be redirected to Page X, Group Y to Page Y and so on.
I realise that I could do that with several {if} statements in my template and {redirect}s but I really need it to continue working if I add more groups without having to edit the template every time to add new statements.
What i've done so far:
1. Created two users "User 1" and "User 2".
2. Created two groups "Group X" and "Group Y".
3. Assigned "User 1" to "Group X" and "User 2" to "Group Y".
4. Created two new pages, one for each user to see when they're logged in.
5. Added an extra attribute value to each of the pages, "Group X" and "Group Y".
6. Added the following code to the template i'm using for protected pages:
Code: Select all
{if $ccuser->loggedin() && $ccuser->memberof($content_obj->GetPropertyValue('extra1'))}
{redirect_page page='($content_obj->GetPropertyValue('extra1'))'}
{content}
{else}
Not authorized
{/if}
I guess i'm on the wrong track here. Could someone give me some guidance please?