Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

differen data for a page based on login id


Go to End


3 Posts   1054 Views

Avatar
BigChris

Community Member, 63 Posts

23 March 2010 at 5:55am

Hello,

This may seem a bit daft at first but I am moving into new territory with SilverStripe.

The scenario is I want to create a client area that is accessed via a login. I have seen how to do this on ssbits.

Once the client has logged in, I would like them to have access to about 5 pages. Basically its an internal quotation system for that client. I would like this to be 5 pages on the Admin side on the Site Tree menu.

However there could be 100 clients and do not want to create 500 pages. Rather have 5 pages that change the displayed data.

It is a database read based on login id.

Are there any recipes / tutorials / examples out there that show how to retrieve data based on login id?

Cheers
Chris

Avatar
Carbon Crayon

Community Member, 598 Posts

24 March 2010 at 1:05am

Hi Chris

What you would need to do is to create a custom function in each pages controller to return the correct data, so something like this (not tested just off the top of my head):

function getMemberContent(){

if($Member = $Member::currentMember()){

$Content = //Do something based on $Member->ID

return $Content;
}
}

Then in your template you can use $MemberContent

Is that the sort of thing you were thinking?

Aram

Avatar
BigChris

Community Member, 63 Posts

25 March 2010 at 12:02am

Hi Aram,

thank you that is ideal.

Cheers
Chris