Newbie help accessing code

It’s possible to override HBS templates using theme components, which can be done from the admin web interface.

Here’s how to do that: Developer’s guide to Discourse Themes

So in your case you would make a new theme component and enter this into it

<script type="text/x-handlebars" data-template-name="components/user-card-contents">

</script>

and then copy the contents of your modified file in between those script tags.

Editing the Discourse files directly is a) not possible on our hosting b) generally not recommended as it will completely break your site when you upgrade. The method above is the way to go - whether you are on our hosting or not!

If you just want to add one user field to the user card, then you might consider using a plugin outlet, which is described a bit higher up in that same article and here. The plugin outlet method requires less changes to the code which will ensure better compatibility when upgrading. It’s a bit less flexible though since it does require an available plugin outlet for your needs.

8 Likes