Jump to:

23490 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » List of members as select field

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: 1297 Views
  • Jatinder
    Avatar
    Community Member
    23 Posts

    List of members as select field Link to this post

    Hello,

    I am developing a custom module and have added a custom page type. I want to add a member with each page of this custom page type.

    That is, when the admin creates a page, he should be able to select a member from a dropdown list of members for a specific group.

    How do I go about this?

    Thanks,
    Jatinder Singh Thind

  • Devlin
    Avatar
    Community Member
    215 Posts

    Re: List of members as select field Link to this post

    $specificGroups = array(1,2,3);
    $Group = new Group();
    $Members = $Group->Members(
                   $limit = '',
                   $offset = '',
                   $filter = "`Group_Members`.GroupID IN ( ".implode(", ",$specificGroups)." )",
                   $sort = 'Member.Email',
                   $join = ''
                );
    new DropdownField('Member1','Member 1',$Members->toDropdownMap('ID'),$this->Member1);

  • Jatinder
    Avatar
    Community Member
    23 Posts

    Re: List of members as select field Link to this post

    Thank you for the response. I will try that out.

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