In this thread, I asked about a feature to allow extra joins in Model/Attachment.php. In his response, Chris D says:
But how can this be done, without modifying core XF files?...Arguably, there'd be nothing stopping an add-on from adding in their own joins, even in XF1...