Edit existing source of the forum

(Alex Temina) #1

If you want to go to the point (tl;dr), skip the first 2 paragraphs :stuck_out_tongue:

I’ve been looking for this since a week ago. I’m starting to think that, somewhat, is not possible.
I’m not a discourse expert, nor a forum creator expert, nor a RoR expert, and I never used a VPS, only hostings for websites. BUT! I’m a software engineer, so no problem :wink:

I have discourse installed in a droplet in Digital Ocean, using docker, so it’s in a container. I’m starting to control how discourse works, and all the admin services, but I wanna go further. I want to make the forum mine, I want to be able to control every single corner of the forum, and of course, that is not possible even with the millions of options that Discourse has from the Admin (Thanks, dudes!).

Let’s go to the point. One of the things I want to do is to edit the existing source. As far as I know, that is not possible with the HTML customization, since this is only adding new elements, and not editing the existing ones. How can I do this?
Let’s put an example to make it easier:

@rewphus points at “Header” when leaving us that beatiful piece of code. But as I said before, it is not possible, since we want to edit something that already exists, the rows of the topics table.
So… how can I do this? Thanks for all the documentation you can supply here, guys.


P.S: I don’t mind If I have to make a plugin or whatever, ready for all :wink:

(eriko) #2

It is completely doable. It is also really bad idea. Something to keep in mind is that Discourse is really three different applications. The Rails app, the redis/sidekiq app doing the jobs proccessing, and the javascript app running in the browser. Not that is really matters as you can muck with them all in the same way.

You will need to fork the code on github and change the docker install to use your repo. Then you will have to merge your changes with those coming from the upstream main discourse repo. Then watch as thing quickly fall out of sync and are no longer be able to use the upstream work of the more than one developer working on this fulltime.


Seriously why do people keep saying they want to go deep and “change everything” at least want to be supported in doing so. There was the person last week that thought is was a great idea to make their own fork with the classes for Topic and Reply changed to Thread and Post.

I am no longer joking. I am actually really intrigued by this. I have a couple small patches on Moodle, Canvas and a few now long gone ones on Discourse to do CAS auth. At no point did I have the urge to make wholesale changes that only I would be supporting.

(Alex Temina) #3

wow, what a nice guy, thanks.

maybe people keep saying they want to go deep because they come from other places like php and symfony, which perspective is really different and you can change the entire web from the one by default, and because @rewphus is putting an example, the one I’m interested in, which made me think is possible to change such things.

I don’t think it is that bad or crazy to ask something, as I said, I’m a newbie.

It’r really easy to say something like “Sorry, it is not possible since the forum is based on 3 applications and it would be impossible to make changes but still be able to update Discourse. But you can make a plugin” for example.



(eriko) #4

Sorry yours was less extreme than some some that I have seen lately. I was overly grumpy in my response. I apologize.

I will say this. Discourse is both very different than the php apps (moodle and a little wordpress) that I have worked on in part because there is an always running application vs way that php is constantly reloading everything*. This is leads to is someways a less dynamic environment because you can not inject live code nearly as easy. It is also worth thinking about how drupal, wordpress, and to some degree moodle are designed as very extensible tools that can to formed into many things. Discourse on the other hand is designed to pretty much do one this well and that is to be a forum. (edit: last two sentences added)

  • yes I know that there is more caching now to compensate for this.

(Alex Temina) #5

no problem :wink:

Thanks for the explanation, I’m starting to understand it, yet Discourse is the most powerful forum I’ve seen.

Then it will be nice if @rewphus explains how should I use his code!


(Logan Mathews) #6

Most everything that you should need to be able to change can be done through plugins or adding text to the customize section of the admin panel. Anything relating to the template is definitely easy enough to override by including either including your own edited version of the .hbs files in your plugin or by adding custom javascript in the admin panel ( see Sam's personal "minimal" topic list design ) as an example.

(eriko) #7

From the looks of it @ColdSun 's answer is correct in that it looks like @rewphus added to or over rode existing handlebars files via a plugin. I wrote an early plugin (cas_auth) and eventually deprecated it in part because it was hard to keep it in sync with the fast moving discourse development cycle. As much as I love discourse I wonder it it is really mature enough to support a plugin ecosystem as it rapidly evolves. A couple popular ones seem to have broken over the weekend.

I agree the above is true and I think that a big part of it a focus on well thought out functionality vs very flexible. This is a change from most of the php apps I have worked on where flexibility is more of a driving force.

(Logan Mathews) #8

Actually, Rewphus’s changes could easily of been modified through the admin customization system. No need to even write a plugin and rebuild the app.

While its true a few plugins seemed to have broken over the weekend, they should be very easy to fix. Plugins don’t often break, so I wouldn’t suggest that it isn’t mature enough to develop modules for. My plugins I’ve been using for cosmetic additions have been working fine without fixes for the last 3 months.

Module abandonment isn’t exclusive to rapidly changing development cycles. A lot of people have an itch to scratch, write a module, and then move on. If the module breaks or needs support but the itch is no longer there, it sits on the wayside.


Wow, the first time I’ve been the source of authority for code (being mostly a front-end guy and all).

@ColdSun is exactly right, I made all of my changes in the admin customization system, just like the example @sam provided in the previously linked “minimal” topic list design. Sam even mentions how easy it is to do from the admin panel in the topic that walks you through how to do it with a plugin.

I also whole heartedly agree with ColdSun’s outlook on Discourse. It is a rapidly evolving tool that continues to grow both it’s functionality and extensibility. I have only made a few very tiny personal plugins, but none of them have been rendered useless over the handful of updates I have taken. As long as you know how it works and understand it may require maintenance from time to time, in my experience the Discourse team and it’s community does a great job in providing you what you need to successfully build and deploy the features you may want.

Let me know if you have any specific questions, @AlexTemina, but be warned. As I mentioned before, I mostly just dabble in front-end stuff and may need to defer to the experts for anything too involved.

Reddit Style picture thumbnail on the left

I’m going to bite because I believe this is directed at me.


Before some of us forum administrators move forward with the next decade in mind (ref to Discourse slogan) we have to be sure that the community from the previous decade comes with.

In 2009 I witnessed a 12-year old forum community revolt in the face of a major corporation. Long story short, the corporation made an at-large purchase of 3 or 4 mid-sized companies that owned various niche websites. Included was the one I had been a part of since 1998. The corporation assumed that along with the formal purchase of these entities that all of the users would come with. They didn’t.

When the announcement came that the forums I belonged to would be moving, a long came a foolish 19-year old who didn’t really know much about anything. He had the less than bright idea to start a free forum on a free website. Shockingly, at that moment in time, the free forum became worth more to the people than anything the major corporate entity could offer. I watched the signups on the free forum go mini-viral for a couple of days before I jumped in. The kids were struggling to put together a “skin” so I made them one that looked EXACTLY like the other. Then the people really started to come – ha! Again, I was absolutely taken back by the community’s response and willingness to jump ship.

Moral of the story, it didn’t matter that the new forum home was to be a mobile friendly and ajaxian .NET application* brought on by some of the American northeast’s finest corporate developers. The bells and whistles were not heard and the community was very set on the look and feel of a basic forum.

So when I thought it was a good idea to change the naming conventions from Category/Topic/Post to Forum/Thread/Post instead I was looking at it from the senile, long-standing member perspective. Why not start off on the right foot? Why is that difficult for you to comprehend?

To maintain intelligent discourse you also need to embrace some of the standard vernacular.

(Mittineague) #11

But it is very easy to over-ride the text of the yml files without forking Discourse.
Forking is something you want to not do unless you have a lot of time on your hands and you really want major changes in the Core code…

(eriko) #12

My thinking was the naming in discourse was in part an attempt to break with the past. Much like the Stack Exchange sites, which have a ancestral connection to Discourse, were a successful attempt to break with the history of experts exchange the same is true with discourse.

So attempting to change the internals in an massively incompatible way instead of skinning the app with a custom language file still make no sense to me. That said it is open source and we are all free to try new things.


I actually didn’t fork the thing. That must have been someone else. But I did pour on about the issue I discussed at an earlier date. Perhaps there was another or perhaps @eriko forged memories on accident.

(eriko) #14

I should have used the word branch as in git checkout -b try_something in your git checkout. Sorry for the confusion.


Are you really apologizing for not insulting me accurately enough?

I don’t understand the attitude. I came here to join the movement!

(Sam Saffron) #16

Topic was chosen cause it is a more flexible bucket

Chat/buying and selling/restaurant review q&a all fit better as topic/replies vs. thread/reply

If someone wants to change visible nomenclature go override localization, gutting the core and renaming tables cause this don’t fit my worldview is an insane, useless and counterproductive effort, with a net effect of just giving you a long term broken and non evolving software platform

But if you insist on doing so, so be it, it’s open source, you get to keep your broken piece once you fork

(Jeff Atwood) #17

It is on our roadmap to allow easy renaming of any English copy. It is just not as easy as you might think.


I posted earlier that I observed 25,000ish changes that would have to be made in order to make that work. I conceded after editing only my server files and I agree with @sam that it would be insane and counterproductive to follow through. In my own defense, however, I was looking at the task through a pattern matching lens. But then I realized how rapidly you guys were updating the versions.

@codinghorror I understand it’s not easy and I have a ton of respect for you people.