How to create a custom button?

Hi,

I’m new to Discourse. I’ve installed it already and am playing around with it. There is one feature I’d really like and maybe this is already possible which is why I’d like to ask.

I want to create a category in my forum which is similar to an image gallery. If the user makes a post in this category, it would appear like a grid with an image thumbnail, and a caption with things like user views, ratings (thumbs up) and date posted.

Note that only this specific category should be shown as grid layout, not other categories.

Furthermore, I want to create my own button that allows a user to upload a specific file. Upon uploading the file, a custom code would convert that file into an image. It’s similar to bbcode. Where is the documentation to create custom buttons with a code?
image

I’m referring to those buttons btw.

Check out these theme-components:

If you want to add a button there, you can reverse engineering other plugins that have successfully done that, like say the Formatting toolbar plugin.

Not sure of the use case of your feature, but that’s why Discourse is free and open, so you can customize it the way you want!

2 Likes

Thanks for the reply! I see that the formatting toolbar conflicts with the official bbcode plugin. I’ll have to uninstall the bbcode then to use this one. I’m still looking for some documentation on how to create plugins that allow one to modify the toolbar or to create custom buttons.

Also, yes, the Topic List Thumbnails Component does exactly what I was looking for. I had installed that earlier but it didn’t work for me since I was on stable.

1 Like

You can keep the official bbcode plugin and use this theme component, it’s more or less the same

2 Likes

Thanks, I’ll look at that code to see if I can make my own custom button.

Just an update on this, it seems that the easiest way to create one’s own custom bbcode is to reverse engineer this plugin: Awesome BBCodes Plugin: multi-paragraph, nestable, with auto-complete rather than the official bbcode plugin according to this thread: Best Course of Action on Supporting Custom BBCode?

If there’s a newer or easier way now to create custom bbcode, please let me know. Thanks.

1 Like