Helper for @member tier

I’ve seen some early discussion about helpers for different tier-related uses, which I know may still be in-progress. I was curious if it’s yet possible to use the @member object to check for a specific tier, in the way that @member.paid works.

For example, I’ve set up my navigation to check access level and display a locked or unlocked icon for each item, one of which is available only to my second tier. With a tier check, it might work like this:

{{#if @member}}
<!--Unlock free member nav items -->
{{else if @member.paid.tier1}}
<!--Unlock free and first tier member nav items -->
{{else if @member.paid.tier2}}
<!--Unlock all nav items -->
{{/if}}

Is something like this possible at the moment, or is it too early?

1 Like

@brooklet I recommend you check this thread… there was quite a bit of discussion around this stuff. Membership Tiers: beta feedback/issues

I’ve not looked at the documentation lately, but I know it was lagging when the membership stuff was fresh out of beta.

At the moment, I’m using something like this (written in Oct '21):

{{#if @member.paid}}
    {{#foreach @products as |product|}}
        {{#foreach @member.subscriptions as |sub|}}
            {{#match sub.price.product.product_id "=" product.id}}
                {{#match sub.status "!=" "canceled"}}
    var memberPlan = '{{product.name}}'.toLowerCase();
                    {{/match}}
            {{/match}}
        {{/foreach}}
    {{/foreach}}
{{else}}
    var memberPlan = "trainee";
{{/if}}

I’ve got the above in a partial inside a javascript block, which basically gives me a javascript variable with the member’s plan name that I can then use as a CSS class name wherever I need it.

Like I said, this was written back in October, so there may well be better ways to do it by now.

3 Likes

Thanks for sharing that, @coffeemonk! Gets me closer than what I’d seen elsewhere, so I’ll see what I can do with that for now.

Just commenting that I also would really like to see this functionality.

How would you conditionally display content based on tier or tier name? Any examples?