Sign Up button doesn't show up anymore with decorateWidget

AI-generated summary

The Sign Up button is no longer displaying next to the Login button, and an error message is shown in the console: “[THEME NAME] decorateWidget: Could not find widget ‘header-buttons’ in registry”. Andreea_Pomirleanu has tried using a script to add the button via Customize → Themes, but it’s not working. Lilly pointed out that decorateWidget has been deprecated for Glimmer components, and RGJ provided a link to the relevant topic: upcoming header changes. Andreea_Pomirleanu is looking into the issue and may have further questions.

Hello! It seems that the Sign Up button we had setup next to the Login button is no longer displaying and I see an error in the console saying “[THEME NAME] decorateWidget: Could not find widget ‘header-buttons’ in registry”

The way this button was added until now, as far as I’m aware, was via Customize → Themes with a script like this:


<script type="text/discourse-plugin" version='0.8.12'>
api.decorateWidget('header-buttons:after', function (helper) {
    if (!api.getCurrentUser()) {
        return helper.attach('link', {
            href: 'https://www.bassbuzz.com/account/signup',
            rawLabel: 'Sign Up',
            className: "btn btn-primary btn-small login-button"
        });
    }
});
</script>

I’ve read some similar topics like this Add button in header for logged in users - #3 by Lilly, but I always get the error of “header-icons” not found in registry.

I have also tried this and it’s the same result:

<script type="text/discourse-plugin" version='0.8.12'>
  api.decorateWidget('header-buttons:after', helper => {
    if (!api.getCurrentUser()) {
      return helper.h('li', [
        helper.h('a.btn.btn-primary.btn-small.login-button', { 
          href: 'https://www.bassbuzz.com/account/signup' 
        }, 'Sign Up')
      ]);
    }
  });
</script>

I also looked at the documentation here: Developing Discourse Themes & Theme Components , but I can’t seem to figure out what I’m missing.

Is there a setting that might prevent the code above from functioning? It has worked before, not sure when it stopped working. Does anyone have any advice? Thank you in advance!

Hi @Andreea_Pomirleanu :wave: welcome to meta :slight_smile:

decorateWidget has been deprecated for Glimmer components. see here for info:

https://meta.discourse.org/t/upcoming-post-menu-changes-how-to-prepare-themes-and-plugins/341014

see below for the right link (thanks RGJ)

It’s in a different topic, Upcoming Header Changes - Preparing Themes and Plugins

Hi @RGJ thank you so much for the quick reply! I’ll get reading and get back to you if I have further questions.