Adding a billing section in the member section

AI-generated summary

In a Dev category discussion titled ‘Adding a billing section in the member section,’ Francois_Douville seeks to add a ‘billing’ link to the user profile interface in Discourse, pointing to a Memberful account. joebuhlig suggests using the user-main-nav plugin outlet, referencing a guide on adding plugin outlets via themes. Francois_Douville implements the outlet with a Handlebars template, asking for clarification on the unique-id, which joebuhlig explains can be any custom identifier. The solution works, as confirmed by Francois_Douville, who later shares an alternative JavaScript-based approach using api.onPageChange() to inject the link directly into the .preferences-nav section for precise placement as shown in their screenshot. The final implementation successfully adds a ‘Facturation’ link to the user preferences page.

I use the Memberful-Discourse integration.

I want to add a “billing” section right here :

In fact, when a user will click on billing, it will convert to the memberful account of the user. I will put a simple link to make it happen. I already have this link. I just want to know the code to add a section here.

Is it possible?

You could likely tie into the user-main-nav connector and add it to the users profile. It’s not exactly the same placement but it would have roughly the same effect.

Ok interesting, can you tell me exactly what I have to do please?

Combine that plugin outlet with this:

{{plugin-outlet name="user-main-nav" tagName='' connectorTagName='li' args=(hash model=model)}}

What is the unique-id?

My code so far is this (what do I have to change?) :

<script type='text/x-handlebars' data-template-name='/connectors/user-main-nav/add-header-links'>
       <a class="nav-link " href="https://lepeuplier.memberful.com/account" target="_blank">Facturation</a>
</script>

I haven’t tested it but that looks good to me. The unique I’d is something you make up for the project.

It worked! Thanks so much!

I wrote a different code to make it appear at the place I want

<script type="text/discourse-plugin" version="0.8">
    api.onPageChange(() =>{
        addNav();
    });
    function addNav(){
        if($('.affiliation-link').length){
            // do nothing 
        } else {
            li = '<li class="no-glyph nav-interface affiliation-link"><a href="https://lepeuplier.memberful.com/account">Facturation</a></li>';
            $(".user-preferences-page .preferences-nav").append(li);
        }
    }

</script>