I hope you are doing fine and this post finds you in good health.
As you may know, if a video or an image get posted in the forum, the link to the media will be written in the forum digest email. Due to some confidentiality issue, we want to remove this link from the email and replace it with the forum post link. I know you have to be logged in to access the video within the post but I have been asked to remove it in case someone would forward the email to someone else outside the course.
My plan is to override the forum email renderer (text and HTML) in my theme, find the media link and replace it with a generic token i.e.: [watch video in post]. Pretty straight forward but I have some uncertainties about the process.
1 – How to detect if the link is a media that should be replaced and not just an href to an article somewhere? Should I write my own file_rewrite_pluginfile_urls() and use the file storage to get the file’s mime type? From there it would be easy to see if the file is allowed in an email and react accordingly.
2 - According to my test, I have to override the forum_post renderer in /mod/forum/classes/output/forum_post.php. Would it be correct to say that the override should be in /theme/mytheme/classes/output/forum_post.php and the namespace should be changed from mod_forum\output; to theme_mytheme\output; Do I have anything else to change to override this renderer?
Every suggestion/advice are welcome.
Thank you in advance for your help.