Trying to edit user.hbs with no results


(Steven Slade) #1

I am trying to modify the user.hbs file my plugin. Doing the standard plugins/myplugin/assets/javascripts/discourse/templates/user/user.hbs and copying the original code and modifying what I need. However, the result is that nothing changes. I am just moving publicUserFields above bio. Any ideas why?

Also, more advanced conversation on this topic that I would be curious to know: Could one create a widget to alter the profile using a virtual dom approach?


(cpradio) #2

Do you have this in a github repo that you can link to?


(Steven Slade) #3

I do now :slight_smile:… simply putting publicUserFields above bio with no change though.


(cpradio) #4

I’m wondering if you need to register it in a plugin.rb file

register_asset "javascripts/discourse/templates/user/user.hbs"

Much like we did for SP (look around line 138)


(Steven Slade) #5

Hmm, added that in and still no changes.


(cpradio) #6

Okay, I need screenshots, as I pulled down your repo and applied it to my local install, it works…


(Steven Slade) #7

Perhaps maybe one of my other plugins are competing with this plugin. The good news is that it works for you.


(cpradio) #8

Or you are not seeing the change because that page is heavily cached, clear your browser cache and check it again.


(Steven Slade) #9

I did a search of my entire local Discourse for all instances of the user.hbs code. The two results were in my plugin and the following: discourse/jsapp/templates/user/user.hbs

We would have expected the other one to be assets/javascripts/discourse/templates/user/user.hbs, right?

So what is jsapp? This could be the reason it is not working for me, because the plugin path does not match what I have on my local discourse.


(cpradio) #10

jsapp (to my knowledge, @eviltrout, correct me where I’m wrong), is the compiled version of Discourse. So it is what actually gets executed, but the code for altering exists in app/assets/javascripts/discourse/templates/user.

You might want to clear your Discourse cache too, rm -Rf tmp/cache/ which would be inside your discourse implementation.

Are you running this locally using the Ubuntu Development guide or via Docker?


(Steven Slade) #11

Ubuntu Development. Cleared Chrome cache and rm -Rf tmp/cache/ as well. Here is the screenshot of mine using the plugin that works for you.


(cpradio) #12

Any errors in the JavaScript console, in the /logs?

And you git cloned into the /plugin folder?


(Steven Slade) #13

I just removed all other plugins and the problem is resolved. So it seems as though one of my other plugins is interfering :grin:


(cpradio) #14

Well, that’s something. :slight_smile: Now the fun chore of re-enabling them one by one to see which one is interfering :slight_smile:


(Steven Slade) #15

So I removed all my plugins except the profile alternate layout. Then I slowly added them all back in one by one. Everything working correctly. Updated profile layout to make sure change would work, everything working correctly. :joy:


(cpradio) #16

lol, then it shall remain a mystery. Oh well, at least you are operation then :slight_smile: