Jump to:

23001 Posts in 11702 Topics by 2827 members

General Questions

SilverStripe Forums » General Questions » differen data for a page based on login id

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

Page: 1
Go to End
Author Topic: 765 Views
  • BigChris
    Avatar
    Community Member
    63 Posts

    differen data for a page based on login id Link to this post

    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

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: differen data for a page based on login id Link to this post

    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

  • BigChris
    Avatar
    Community Member
    63 Posts

    Re: differen data for a page based on login id Link to this post

    Hi Aram,

    thank you that is ideal.

    Cheers
    Chris

    765 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.