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.

General Questions /

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

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

differen data for a page based on login id


Reply


3 Posts   885 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