Adapt github changes to my own site

Like @tophee said, plugins do not need to be complicated. Here’s another really simple plugin you can look at (this one increases the maxiumum value allowed in a site setting): https://github.com/jomaxro/discourse-plugin-site-setting-override.


Let me speak from personal experience about why modifying source code is a bad idea. Before working for Discourse I worked for a company that used Discourse internally. They had linked it to a WordPress install, and instead of using the API to connect WP to Discourse they decided to add a custom route to Discourse. They did this by copying the routes.rb file, adding the new route, and then overwriting the routes.rb file any time Discourse updated. As new routes were added by Discourse they were “removed” by the modified routes.rb file that was overwriting it. Eventually the homepage route was modified and we overwrote it on update, causing Discourse to frequently throw errors.

The file was modified in mid-2016. We started seeing errors in mid-2017. It took nearly a week to track down the cause of the errors, because we assumed something had changed recently, not something that hadn’t been touched in a year.

tl;dr: Don’t modify files directly. Even if they don’t hurt you today they can come back and bite when you least expect it.

10 Likes