Hello everyone!
I currently encounter a problem for which I would like some help finding a solution. My educational membership site has three paid tier levels, and for each one, I would like to provide different resources at the end of the same post. Considering that any tier can see what is available to the neighboring tier, the resources include different downloadable files and Google Drive links.
Is it possible to use the same post and make the last section (Resources) different for each tier, providing the conditions above? Or should I duplicate the post and change the last section for each tier and limit the access to the corresponding tier? If so, how can I prevent showing three similar posts on my archive page to my members? It would be awkward and confusing to have the same post appearing three times to everyone.
By the way my theme is Source! I’m no expert in code but, Is there a code I could add on the default.hbs??
Thanks for any Help provided to this matter!
I will much appreciate!
Renato
Are the resources the same on all posts, or different? It’s possible to detect (with handlebars, in the theme) which tier a member is on and write something different on the page, but you’d have to hard-code that into the theme (or perhaps #get it from a different page.
Actually, here’s an idea.
For any post with a resources section, create a page with a spliced together slug. So if the post is why-ai-is-evil, and your tiers are bronze and silver, make pages like resources-why-ai-is-evil-bronze and resources-why-ai-is-evil-silver. (Set these resources page to the access level matching their tier.)
After displaying the regular post content, then check the user’s tier, and #get the page, filtering on the spliced-together slug.
Hi @Cathy_Sarisky !
Thanks a lot for your insight.
Actually the resources are exclusive for each post ( and then leveled in tiers)
Please tell me if I’m understanding correctly your idea:
- A bronze member views the post
why-ai-is-evil
.
- The code in my theme detects that the member is bronze.
- The code then fetches and displays the content from the
resources-why-ai-is-evil-bronze
page at the end of the post, showing a different resource section at the end of the post.
- Similarly, if a silver member views the same post, the
resources-why-ai-is-evil-silver
page is fetched and displayed to him.
So if this is possible, how would everything work with the Newsletter? Would its content be filtered and shown the same way?
And about the code itself? Can you provide a starting point code so I can experiment and see if everything works properly? I assume the code would be inserted in post.hbs
?
Once again, thanks a lot for your feedback. There isn’t much help available regarding these kinds of issues, so I appreciate your kindness and altruism very much!
It won’t work for newsletters. For newsletters, duplicate content is your best bet. (And if you’re going to do it for newsletters, perhaps you should just do it for web posts also.)
But if you do want to use that approach, something like (not tested)
{{#foreach @products as |product|}}
{{#match @member.subscriptions.0.price.product.product_id "=" product.id}}
{{#get pages filter="slug:{{product.id}}-{{somethingelse}}" }}
{{#foreach pages}}
{{content}}
{{#foreach}}
{{/get}}
{{/match}}
{{/foreach}}
Membership code borrowed from: Detecting a member's tier - #6 by joesb
Things to watch out for: Members who’ve created and cancelled subscriptions may have multiple subscriptions being looped over, so matching on [0] my be wrong.
You’d want to pass in the slug of the post from the outer context, but you can’t do that with …/slug, because filters won’t take that. See an example of passing into a partial to avoid this in my code here: (better approach?) A better related block for Ghost