Can I customize Discourse by editing Ruby files in the same way I customize Wordpress by editing PHP files?


(Minghui Yu) #1

Just installed Discourse a few days ago. It is amazing!

I have made some customization through admin control panel. However, I am stuck when I want to make further customization beyond what control panel offers.

Where can I edit template files? Do I have to write a plugin to customize the appearance of Discourse?

Thanks,


#2

@Minghui_Yu - It's easy far as i consider it. Go to your admin panel (ex; www.minghui.com/admin/customize/colors) and modify anything u want. wink


(Minghui Yu) #3

Thank you, @dbm

I want to do more customization beyond CSS change. For example, I want to put a few blocks (some blocks contain data from Discourse and some contain data from external resources) on different areas of pages. I tried the admin panel but I cannot.


(Kane York) #4

You can do it, if you redefine templates.

There’s an example here:


(Minghui Yu) #5

Thank you, @riking This tutorial is very helpful!

So other than simple CSS tricks (change color/size, hide a div, for example), all other changes need to be done via API? Is Discourse.TopicListItemView.reopen an API call?

I came from PHP community and I am quite familiar with Drupal/Wordpress, which can be customized quite a bit. Can I customize Discourse to the same extent?

Thanks.


(Anonymous) #6

I’d love to know too. I asked a similar question a few hours ago, and no reply at all. If Discourse is to be widely adopted is has to be developer/plugin/customization friendly…and maybe it is.


(Sam Saffron) #7

That is a very open question, what exactly are you trying to do? Please provide some mockups/screenshots.


(Kane York) #8

No, importantly - those are NOT api calls. That’s directly messing with the JavaScript code.

Most of the Discourse rendering and logic code is structured in a way that you can swap it out for your own version(s), which is what’s happening in that code. You may not be a happy camper doing it, but it’s largely possible.


(Minghui Yu) #9

For example, a user can set flexible criteria on who can reply to his thread or his message.

Some criteria:

Only those with reputation > X can reply my thread;
Only those with reputation > Y can reply to my message
Those who are in my blacklist cannot reply to my message


(Sam Saffron) #10

What is reputation?

Block lists are not implemented, implementing in a plugin though feasible, is not trivial.


(Minghui Yu) #11

Sorry, here “Reputation” is similar to “Badges”.


(Mittineague) #12

I terms of Trust Level all of those are to some extent possible or moot.

>x reply to thread
Group settings per Category

>y reply to message
if you don’t want a member to reply, why send it to them?

blacklist
the “mute user” feature


(Sam Saffron) #13

Really there is not enough detail in your request for me to help you, I need specifics.

The general answer I guess is, yes you can extend Discourse to do almost anything, its tricky though.


(Minghui Yu) #14

Per category settings help but are enough.

Why send it to them?

Because the message is visible to everyone. I assume that “Mute user” suppress all notifications from a user but does not prevent from those muted users to reply to a thread. (Imagine user A has an “enemy”, user B. user A does not want user B to mess up his thread.)


(Minghui Yu) #15

My example is for illustration purpose only. My real question is how much effort will it need to customize Discourse. For example, in Drupal, basically every action offers a hook and I can customize the action.


(Sam Saffron) #16

I can’t tell you how hard its going to be unless you tell me exactly what you want to do.


(Mittineague) #17

Sorry, I thought you meant message as in “Private Message” not as in “a topic”

How familiar are you working with RoR and Ember, handlebar templatingr?
IMHO the biggest problems are paucity of documentation, not a lot of examples to analyze, and that the Core code changes frequently.

Good and Bad. Bad that you need to keep up with changes, Good that you have a chance of influencing changes if …


(Minghui Yu) #18

My apology. Here message means my reply to someone else thread.


(Jeff Atwood) #19

I changed the topic to better reflect the goal, and no, that’s not possible. You can edit a lot of the core PHP files in WordPress and Drupal to do literally anything.

That’s not a strategy we plan to pursue in Discourse.

We’ve done at least one round on extensibility and we have many official plugins that we ship. We’ll continue to enhance the plugin architecture as we go.


(Dean Taylor) #20

You can - but any WordPress developer worth spitting at would use the WordPress API, in this case WordPress Theme Development and WordPress hooks.
!! Never edit the core people !!

In the same way I would never recommend editing the core of Discourse, if there isn’t an available to override / or hook into the exact part of Discourse you want to request it!

I have seen the Discourse team being very open and forthcoming in helping both in the short term and considering what is needed change-wise for the future.

Help build Discourse into the extensible product you want it to be.