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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

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

Specific member group on ModelAdmin in SS3


Go to End


1035 Views

Avatar
sajok

Community Member, 82 Posts

21 April 2013 at 12:54am

Hello,

I created a group for "Students", and I want to have a ModelAdmin section that lists only members from group "Students". Using the following code lists all site members:

class StudentsAdmin extends ModelAdmin {
  public static $managed_models = array('Member');
  static $url_segment = 'Students'; 
  static $menu_title = 'Students';

  public function getList() {
        $list = parent::getList();
        // ...
        return $list;
    }
}

I'm trying to use the getList() function to exclude all groups except Students group, something like:

$list->exclude('Group', 'Admins');

any help how I can do this?

Thanks