# Hide Posts for User Without Access

**URL:** <https://forum.ghost.org/t/hide-posts-for-user-without-access/53712>\
**Category:** Memberships & subscriptions\
**Created:** [December 31, 2024, 6:03am UTC](https://forum.ghost.org/t/hide-posts-for-user-without-access/53712 "2024-12-31T06:03:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpd](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jpd](https://forum.ghost.org/u/jpd)\
**Post date:** [December 31, 2024, 6:03am UTC](https://forum.ghost.org/t/hide-posts-for-user-without-access/53712/1 "2024-12-31T06:03:31Z")

</div>

When a user isn’t logged in, post titles are still displaying on the homepage and if they know the name of a tag. I’d like to hide the post titles unless a member is signed in and is part of a membership tier that can view the post.

I tried modifying the theme files to add the access variable, but that doesn’t seem to work. Now nobody can see the post titles!

Here’s a snippet of code from the modified tag page -

```auto
    {{#if access}}
    <div class="post-feed gh-feed gh-canvas">
        {{#foreach posts}}
            {{> "loop"}}
        {{/foreach}}
    </div>

    {{pagination}}
    {{else}}
    <h3 style="margin: auto; width: 50%; padding: 10px;">You need to be a member to view posts. Click "Subscribe" in the upper-right to begin!</h3>
    {{/if}}

```

How do I fix this, or what have I done wrong? Everybody is seeing the text of the else statement.

Here’s the article I was looking at - [Ghost Theme Development: Building custom membership flows](https://ghost.org/docs/themes/members/?_ga=2.37368160.1397637945.1735587427-1313544209.1735587427#access)

---

<div class="post-metadata">

**Author:** ![Cathy\_Sarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cathy_sarisky/32/25750_2.png) [@Cathy\_Sarisky](https://forum.ghost.org/u/Cathy_Sarisky)\
**Post date:** [December 31, 2024, 1:27pm UTC](https://forum.ghost.org/t/hide-posts-for-user-without-access/53712/2 "2024-12-31T13:27:30Z")

</div>

Access is specific to individual posts. So you’d need to move the logic into the loop partial. Or perhaps if you have a mix of public and not public content, you’ll want to retrieve different content based on @member.paid or @member being truthy.

---

<div class="post-metadata">

**Author:** ![jpd](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jpd](https://forum.ghost.org/u/jpd)\
**Post date:** [January 7, 2025, 4:56am UTC](https://forum.ghost.org/t/hide-posts-for-user-without-access/53712/3 "2025-01-07T04:56:03Z")

</div>

Member Paid doesn’t necessarily mean the member can access something if there’s multiple membership tiers.

What do you mean by move the logic into the loop?

---

<div class="post-metadata">

**Author:** ![Cathy\_Sarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cathy_sarisky/32/25750_2.png) [@Cathy\_Sarisky](https://forum.ghost.org/u/Cathy_Sarisky)\
**Post date:** [January 7, 2025, 1:39pm UTC](https://forum.ghost.org/t/hide-posts-for-user-without-access/53712/4 "2025-01-07T13:39:08Z")

</div>

> [@jpd](#):
>
> What do you mean by move the logic into the loop?

Right now you’re trying to check access generically, not in the context of a post. You need to check within the context of a single post, whether the user can access that post.
