Page 1 of 1

FEU Redirect based on User groups

Posted: Sun Aug 24, 2014 5:14 pm
by crayonweilder
I am trying to use the CustomContent and Front End User Modules to create a selection of pages specific to each client.

What I am trying to achieve is that a customer, who is a member of the FEU group = "Customer-A", "Customer-B" etc, logs in to the login page for the site, they are re-directed to their home page based on their group identity. I was trying to keep it fairly simple so in the CMS the structure is:

1. Login
1.1 Redirect
2. Customer-A
2.1 Customer-A-Home-Page
2.2 Customer-A-Details
2.3 Customer-A-Page-3
3. Customer-B
3.1 Customer-B-Home-Page
3.2 Customer-B-Details
3.3 Customer-B-Page-3
4. Customer-C
4.1 Customer-C-Home-Page
4.2 Customer-C-Details

And so, on. The plan was the menu will only show level 2, so Customer-A wouldn't see Customer-B's menus. Then the redirect page could easily manage as we add more clients (the pages don't contain anything particularly sensitive, just brand guidelines etc.)

I don't know if this is achievable, or if there is a better way of doing this but was wondering if I could do an if else query????
e.g.
{if !$ccuser->memberof("Customer-A")}{redirect_page page="Customer-A-Home-Page"}{/if}

then else as many as I need to validate????

I'm no coder, so this is all a bit of an unknown to me and I couldn't figure out how to have multiple if else to check the memberof status.

Any ideas, everything is working just looking for a solution to this.?

Thanks

Using CMSMS 1.11.11 /Linux/PHP5.4.28

Re: FEU Redirect based on User groups

Posted: Mon Aug 25, 2014 9:16 am
by staartmees
You don't need al that fuss. What you wan't to achieve is something FEU and CustomContent simply do.
Calguy wrote a simple manual, http://calguy1000.com/uploads/1/Hiding_ ... e-pdf.html

Re: FEU Redirect based on User groups

Posted: Mon Aug 25, 2014 5:39 pm
by crayonweilder
Hi staartmees, I looked through the manual but couldn't really follow what to do with multiple groups?

The reason we chose to do it in this way is that each customer uses a separate CSS and template and thought that a simple redirect after login would be the easiest and simplest way to achieve this and we could easily manage as we add more customer.

Re: FEU Redirect based on User groups

Posted: Mon Aug 25, 2014 7:18 pm
by staartmees
your pagestructure is ok
you make different groups in FEU
you assign your users to one or multiple groups
for each protected page, see under options and select the according group(s)

Re: FEU Redirect based on User groups

Posted: Mon Aug 25, 2014 8:50 pm
by crayonweilder
Thank you, from that I've figured out what I was after.

My redirect page looks like this, making it easy to add new customers:

{if ccUser::memberof('Customer-A')}{redirect_page page='Customer-A-Home-Page'}
{elseif ccUser::memberof('Customer-B')}{redirect_page page='Customer-B-Home-Page'}
{elseif ccUser::memberof('Customer-C')}{redirect_page page='Customer-C-Home-Page'}
{else}
{redirect_page page='login'}
{/if}

Then in the template page I've used this for the Customer pages (not for the redirect page)

{if ccUser::loggedin() && ccUser::memberof({page_attr key='extra1'})}

And used the Extra Attribute 1 = Customer-Name

so they can't get to other customers pages.

Don't know if this is the neatest way but it works how I was hoping so happy with that.

Thanks for your assistance.