Trying to edit user.hbs with no results

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?

1 Like

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

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

https://github.com/stevenpslade/discourse-alt-profile-layout-new/blob/master/assets/javascripts/discourse/templates/user/user.hbs

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)
https://github.com/sitepoint/discourse-theme/blob/3ed0e82813e2b5b40eb42cda33ed95f9b8694dd0/plugin.rb

Hmm, added that in and still no changes.

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

3 Likes

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

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

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.

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?

3 Likes

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.

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

And you git cloned into the /plugin folder?

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

1 Like

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:

1 Like

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:

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

1 Like