original_string: private function get_conversations_for_user(int $userid) : moodle_recordset {
          global $DB;
  
          // We shouldn't be joining directly on the group table as group
          // conversations may (in the future) be something created that
          // isn't related to an actual group in a course. However, for
          // now this will have to do before 3.7 code freeze.
          // See related MDL-63814.
          $sql = "SELECT DISTINCT mc.id, mc.name, c.id as courseid, c.fullname as coursename, g.id as groupid,
                                  g.picture, g.hidepicture
                    FROM {message_conversations} mc
                    JOIN {groups} g
                      ON mc.itemid = g.id
                    JOIN {course} c
                      ON g.courseid = c.id
                    JOIN {message_email_messages} mem
                      ON mem.conversationid = mc.id
                   WHERE mem.useridto = ?
                     AND mem.id <= ?";
  
          return $DB->get_recordset_sql($sql, [$userid, $this->maxid]);
      }
code: private function get_conversations_for_user(int $userid) : moodle_recordset {
          global $DB;
  
          // We shouldn't be joining directly on the group table as group
          // conversations may (in the future) be something created that
          // isn't related to an actual group in a course. However, for
          // now this will have to do before 3.7 code freeze.
          // See related MDL-63814.
          $sql = "SELECT DISTINCT mc.id, mc.name, c.id as courseid, c.fullname as coursename, g.id as groupid,
                                  g.picture, g.hidepicture
                    FROM {message_conversations} mc
                    JOIN {groups} g
                      ON mc.itemid = g.id
                    JOIN {course} c
                      ON g.courseid = c.id
                    JOIN {message_email_messages} mem
                      ON mem.conversationid = mc.id
                   WHERE mem.useridto = ?
                     AND mem.id <= ?";
  
          return $DB->get_recordset_sql($sql, [$userid, $this->maxid]);
      }
code_tokens: private function get_conversations_for_user ( int $ userid ) : moodle_recordset { global $ DB ; // We shouldn't be joining directly on the group table as group // conversations may (in the future) be something created that // isn't related to an actual group in a course. However, for // now this will have to do before 3.7 code freeze. // See related MDL-63814. $ sql = "SELECT DISTINCT mc.id, mc.name, c.id as courseid, c.fullname as coursename, g.id as groupid,
                                  g.picture, g.hidepicture
                    FROM {message_conversations} mc
                    JOIN {groups} g
                      ON mc.itemid = g.id
                    JOIN {course} c
                      ON g.courseid = c.id
                    JOIN {message_email_messages} mem
                      ON mem.conversationid = mc.id
                   WHERE mem.useridto = ?
                     AND mem.id <= ?" ; return $ DB -> get_recordset_sql ( $ sql , [ $ userid , $ this -> maxid ] ) ; }
docstring: Returns an array of unique conversations that require processing.
  
  @param int $userid The ID of the user we are sending a digest to.
  @return moodle_recordset A moodle_recordset instance.
docstring_tokens: Returns an array of unique conversations that require processing .