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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Data Model Questions /

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

Specific member group on ModelAdmin in SS3


Go to End


762 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