original_string: public static function get_group_members($groupids) {
          $members = array();
  
          $params = self::validate_parameters(self::get_group_members_parameters(), array('groupids'=>$groupids));
  
          foreach ($params['groupids'] as $groupid) {
              // validate params
              $group = groups_get_group($groupid, 'id, courseid, name, enrolmentkey', MUST_EXIST);
              // now security checks
              $context = context_course::instance($group->courseid, IGNORE_MISSING);
              try {
                  self::validate_context($context);
              } catch (Exception $e) {
                  $exceptionparam = new stdClass();
                  $exceptionparam->message = $e->getMessage();
                  $exceptionparam->courseid = $group->courseid;
                  throw new moodle_exception('errorcoursecontextnotvalid' , 'webservice', '', $exceptionparam);
              }
              require_capability('moodle/course:managegroups', $context);
  
              $groupmembers = groups_get_members($group->id, 'u.id', 'lastname ASC, firstname ASC');
  
              $members[] = array('groupid'=>$groupid, 'userids'=>array_keys($groupmembers));
          }
  
          return $members;
      }
code: public static function get_group_members($groupids) {
          $members = array();
  
          $params = self::validate_parameters(self::get_group_members_parameters(), array('groupids'=>$groupids));
  
          foreach ($params['groupids'] as $groupid) {
              // validate params
              $group = groups_get_group($groupid, 'id, courseid, name, enrolmentkey', MUST_EXIST);
              // now security checks
              $context = context_course::instance($group->courseid, IGNORE_MISSING);
              try {
                  self::validate_context($context);
              } catch (Exception $e) {
                  $exceptionparam = new stdClass();
                  $exceptionparam->message = $e->getMessage();
                  $exceptionparam->courseid = $group->courseid;
                  throw new moodle_exception('errorcoursecontextnotvalid' , 'webservice', '', $exceptionparam);
              }
              require_capability('moodle/course:managegroups', $context);
  
              $groupmembers = groups_get_members($group->id, 'u.id', 'lastname ASC, firstname ASC');
  
              $members[] = array('groupid'=>$groupid, 'userids'=>array_keys($groupmembers));
          }
  
          return $members;
      }
code_tokens: public static function get_group_members ( $ groupids ) { $ members = array ( ) ; $ params = self :: validate_parameters ( self :: get_group_members_parameters ( ) , array ( 'groupids' => $ groupids ) ) ; foreach ( $ params [ 'groupids' ] as $ groupid ) { // validate params $ group = groups_get_group ( $ groupid , 'id, courseid, name, enrolmentkey' , MUST_EXIST ) ; // now security checks $ context = context_course :: instance ( $ group -> courseid , IGNORE_MISSING ) ; try { self :: validate_context ( $ context ) ; } catch ( Exception $ e ) { $ exceptionparam = new stdClass ( ) ; $ exceptionparam -> message = $ e -> getMessage ( ) ; $ exceptionparam -> courseid = $ group -> courseid ; throw new moodle_exception ( 'errorcoursecontextnotvalid' , 'webservice' , '' , $ exceptionparam ) ; } require_capability ( 'moodle/course:managegroups' , $ context ) ; $ groupmembers = groups_get_members ( $ group -> id , 'u.id' , 'lastname ASC, firstname ASC' ) ; $ members [ ] = array ( 'groupid' => $ groupid , 'userids' => array_keys ( $ groupmembers ) ) ; } return $ members ; }
docstring: Return all members for a group
  
  @param array $groupids array of group ids
  @return array with  group id keys containing arrays of user ids
  @since Moodle 2.2
docstring_tokens: Return all members for a group