Jump to:

5521 Posts in 1733 Topics by 1220 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Asigning member from one group to a page (has_one)

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

Page: 1
Go to End
Author Topic: 480 Views
  • Zyzzza
    Avatar
    Community Member
    25 Posts

    Asigning member from one group to a page (has_one) Link to this post

    Hi all,

    I have a product page which has "has_one" => 'member' .

    What i would like to create - is a Tab in CMS where i could list has_one list (radiobuttons) but ONLY WITH MEMBERS from certain group (for example group id =4) .

    Basically as I've got around 500 users (and growing) as buyers and only 4-5 as sellers. I knwo how I can show ALL members , however not sure how to strict the list to buyers only.

    Any help would be appreciated

  • Zyzzza
    Avatar
    Community Member
    25 Posts

    Re: Asigning member from one group to a page (has_one) Link to this post

    Thanks to IRC - adding some query WHERE and JOIN clauses helped :

    jus in case someone will be looking for same solution heres my code:

    $tablefield = new HasOneComplexTableField(
    $this, //controller
    'Seller', //name
    'Member', //source
    array( //fields
    'FirstName' => 'First Name',
    'Email' => 'Email'
    ),
    'getCMSFields_forPopup', //detail form fields
    '"Group_Members"."GroupID" = 4',
    '',
    'JOIN "Group_Members" ON "Member"."ID" = "Group_Members"."MemberID"'
    );
    $tablefield->setParentClass('Member');

    $fields->addFieldToTab( 'Root.Content.Pardavejas', $tablefield );

    480 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.