Hiding paid members posts

Hi -

is there a way not to show paid members’ post excerpt to either free members and/or public? In other words, if a post is for paid members anyone with lower access levels wouldn’t even know the post exists.

Thank you!

Hey @Vitalik :wave:

That’s totally possible with the use of custom collections and routes. We’ve written up a method of doing so in our docs, where you can create custom collections that filter out your paying content from your main site collection:

Hope this helps!

1 Like

Thanks, David - I’ll take a look.

1 Like

Hi @Vitalik,
if you want to completely hide posts from being shown on your page, depending on the user level, you could use something like this.

(I tested it in the lyra theme, which is based on casper):
Basically if you’re a paid member, you can see every post
(visibility="all")
If you’re a member, you can see the public and the members content (visibility="public,members")
If you’re a public visitor, you can only see public content.
(visibility="public")

{{#if @member.paid}}
        {{#foreach posts visibility="all"}}
        {{> "post-card"}}
        {{/foreach}}
    {{else}}
        {{#if @member}}
        {{#foreach posts visibility="public,members"}}
        {{> "post-card"}}
        {{/foreach}}
    {{else}}
        {{#foreach posts visibility="public"}}
        {{> "post-card"}}
        {{/foreach}}
    {{/if}}
{{/if}}

Let me know if you need help.

3 Likes

Side note to @daniel1’s technique, this may cause issues with pagination. Defining proper collection pages will ensure pagination will work as expected :+1:

Thanks, Daniel and David. For now, I went with Daniel’s solution because, honestly, I could not figure out how to make a single “/:” collection work for three different levels with the same logic as in Daniel’s post: if @member.paid - show all posts, if @member - show public and members, and just public otherwise. Maybe it’s not possible with one collection and three collections would be necessary instead. But than there is additional complexity of directing users to proper collection depending on their access level.

The difference between my method and Daniel’s is that mine would create different pages that list different posts based on their visibility, whereas Daniel’s show/hide posts depending on their visibility level on the same page. Really depends on what you’re going for :blush:

I have the opposite problem: with a default install of Ghost and the Caspar theme, my paid posts do NOT show up for anyone but paying members :(. This is bad, because I would love to tease public/free members with these paid posts. How can I turn the visibility for paid posts on?

By the way: the counters DO include the invisible paid post. You can see this on this pretty empty category, which has 1 public post and 1 paid-members post: Improvise - Real World Music Theory . It says “A collection of 2 posts”, yet only shows one post (no teaser no nothing for the other).

Would you like paid posts to be completely visible? Or paid posts to have teaser content? If it’s the former then you should probably not set them for paid only, if it’s the latter then either switch to Lyra which has this built in while still looking like Casper or use @daniel1’s code sample above to modify your version of Casper:

1 Like

How would the conditional be used with Tiers where one tier is not checked in the portal and is invite-only?

I have Free-Public posts, Member-Posts (no cost members), Premium-Member-Paid posts (subscribed paying members), and Invite-Only posts.

My goal is for the Invite-Only posts to be visible only to those people I grant the tier to. They can’t sign up for the Invite-Only tier.

All the other posts can remain with default visibility, but once an Invite-Only user logs in they will be able to see Public, Paid, plus Invite-Only posts.

Most themes that are up to date with Ghost should handle this out of the box using the visibility filter correctly in post lists and the access helper shown here:

Ghost will know what access a member should have so long as you’re applying the right settings to the post in Ghost Admin

Hi all,

Reading through all this and I’m more confused than when I started. I have a simple goal, only see paid members only posts when signed in. If not signed in you can’t see anything that its paid, no teasers to locked content etc, you don’t even know it exists.

The code snippet from Daniel1 above looks like it will work but not sure if it’s the most up to date method. Not too keen on editing the theme either, makings updating harder. Maybe I should do a feature request if this can’t be put into a code snipped section

Thank you all for your time.