original_string: public static function get_conversations_between_users(int $userid1, int $userid2,
                                                             int $limitfrom = 0, int $limitnum = 20) : array {
  
          global $DB;
  
          if ($userid1 == $userid2) {
              return array();
          }
  
          // Get all conversation where both user1 and user2 are members.
          // TODO: Add subname value. Waiting for definite table structure.
          $sql = "SELECT mc.id, mc.type, mc.name, mc.timecreated
                    FROM {message_conversations} mc
              INNER JOIN {message_conversation_members} mcm1
                      ON mc.id = mcm1.conversationid
              INNER JOIN {message_conversation_members} mcm2
                      ON mc.id = mcm2.conversationid
                   WHERE mcm1.userid = :userid1
                     AND mcm2.userid = :userid2
                     AND mc.enabled != 0
                ORDER BY mc.timecreated DESC";
  
          return $DB->get_records_sql($sql, array('userid1' => $userid1, 'userid2' => $userid2), $limitfrom, $limitnum);
      }
code: public static function get_conversations_between_users(int $userid1, int $userid2,
                                                             int $limitfrom = 0, int $limitnum = 20) : array {
  
          global $DB;
  
          if ($userid1 == $userid2) {
              return array();
          }
  
          // Get all conversation where both user1 and user2 are members.
          // TODO: Add subname value. Waiting for definite table structure.
          $sql = "SELECT mc.id, mc.type, mc.name, mc.timecreated
                    FROM {message_conversations} mc
              INNER JOIN {message_conversation_members} mcm1
                      ON mc.id = mcm1.conversationid
              INNER JOIN {message_conversation_members} mcm2
                      ON mc.id = mcm2.conversationid
                   WHERE mcm1.userid = :userid1
                     AND mcm2.userid = :userid2
                     AND mc.enabled != 0
                ORDER BY mc.timecreated DESC";
  
          return $DB->get_records_sql($sql, array('userid1' => $userid1, 'userid2' => $userid2), $limitfrom, $limitnum);
      }
code_tokens: public static function get_conversations_between_users ( int $ userid1 , int $ userid2 , int $ limitfrom = 0 , int $ limitnum = 20 ) : array { global $ DB ; if ( $ userid1 == $ userid2 ) { return array ( ) ; } // Get all conversation where both user1 and user2 are members. // TODO: Add subname value. Waiting for definite table structure. $ sql = "SELECT mc.id, mc.type, mc.name, mc.timecreated
                    FROM {message_conversations} mc
              INNER JOIN {message_conversation_members} mcm1
                      ON mc.id = mcm1.conversationid
              INNER JOIN {message_conversation_members} mcm2
                      ON mc.id = mcm2.conversationid
                   WHERE mcm1.userid = :userid1
                     AND mcm2.userid = :userid2
                     AND mc.enabled != 0
                ORDER BY mc.timecreated DESC" ; return $ DB -> get_records_sql ( $ sql , array ( 'userid1' => $ userid1 , 'userid2' => $ userid2 ) , $ limitfrom , $ limitnum ) ; }
docstring: Returns all conversations between two users
  
  @param int $userid1 One of the user's id
  @param int $userid2 The other user's id
  @param int $limitfrom
  @param int $limitnum
  @return array
  @throws \dml_exception
docstring_tokens: Returns all conversations between two users