original_string: public static function get_group_members_in_context(userlist $userlist, string $component, int $itemid = 0) {
          $context = $userlist->get_context();
  
          if (!$context instanceof \context_course) {
              return;
          }
  
          // Group members in the given context.
          $sql = "SELECT gm.userid
                    FROM {groups_members} gm
                    JOIN {groups} g ON gm.groupid = g.id
                   WHERE g.courseid = :courseid AND gm.component = :component";
          $params = [
              'courseid'      => $context->instanceid,
              'component'     => $component
          ];
  
          if ($itemid) {
              $sql .= ' AND gm.itemid = :itemid';
              $params['itemid'] = $itemid;
          }
  
          $userlist->add_from_sql('userid', $sql, $params);
  
          // Get the users with some group conversation in this context.
          \core_message\privacy\provider::add_conversations_in_context($userlist, 'core_group', 'groups', $itemid);
      }
code: public static function get_group_members_in_context(userlist $userlist, string $component, int $itemid = 0) {
          $context = $userlist->get_context();
  
          if (!$context instanceof \context_course) {
              return;
          }
  
          // Group members in the given context.
          $sql = "SELECT gm.userid
                    FROM {groups_members} gm
                    JOIN {groups} g ON gm.groupid = g.id
                   WHERE g.courseid = :courseid AND gm.component = :component";
          $params = [
              'courseid'      => $context->instanceid,
              'component'     => $component
          ];
  
          if ($itemid) {
              $sql .= ' AND gm.itemid = :itemid';
              $params['itemid'] = $itemid;
          }
  
          $userlist->add_from_sql('userid', $sql, $params);
  
          // Get the users with some group conversation in this context.
          \core_message\privacy\provider::add_conversations_in_context($userlist, 'core_group', 'groups', $itemid);
      }
code_tokens: public static function get_group_members_in_context ( userlist $ userlist , string $ component , int $ itemid = 0 ) { $ context = $ userlist -> get_context ( ) ; if ( ! $ context instanceof \ context_course ) { return ; } // Group members in the given context. $ sql = "SELECT gm.userid
                    FROM {groups_members} gm
                    JOIN {groups} g ON gm.groupid = g.id
                   WHERE g.courseid = :courseid AND gm.component = :component" ; $ params = [ 'courseid' => $ context -> instanceid , 'component' => $ component ] ; if ( $ itemid ) { $ sql .= ' AND gm.itemid = :itemid' ; $ params [ 'itemid' ] = $ itemid ; } $ userlist -> add_from_sql ( 'userid' , $ sql , $ params ) ; // Get the users with some group conversation in this context. \ core_message \ privacy \ provider :: add_conversations_in_context ( $ userlist , 'core_group' , 'groups' , $ itemid ) ; }
docstring: Add the list of users who are members of some groups in the specified constraints.
  
  @param   userlist    $userlist   The userlist to add the users to.
  @param   string      $component  The component to check.
  @param   int         $itemid     Optional itemid associated with component.
docstring_tokens: Add the list of users who are members of some groups in the specified constraints .