Restrict Content To Staff

Hi there,

I am trying to restrict some content (pages) to registered staff members of my blog.

As far as I can tell, it isn’t possible to do this with the visibility settings on the page backend, so I’m looking to create a custom page template to achieve what I’m after

custom-staff-only.hbs

Is anyone able to tell me if it is possible to do an ‘if’ statement to test if the current user is a member of staff?

Something along the lines of {{if @ staff}}

Thanks for any help

Paul

1 Like

There’s nothing in handlebars that’ll do that, I think.

IF your front end and admin pages are on the same domain (not the case for Ghost Pro users), I think you could do a fetch to the Admin API with include credentials to get the post content and put it on the page. (You could also have your staff users do a separate login - see Ghost Admin API Documentation for some options.) So maybe you could have some posts that are not visible anywhere on the front end normally, but you also have a special template on the front end that uses javascript to make a request including the admin cookie (or runs a whole authentication flow), and then renders the page with the content retrieved. Could be done, but not a trivial task.

Another workaround: Make a tier that you put only your staff users in. (Don’t display it in Portal - there’s a checkbox for that.) Restrict those staff user posts to just that tier.

1 Like

Thank you for the detailed reply!

Sadly I don’t have the knowledge to be able to even begin your first ideas (and I’m on ghost pro).

Your membership tier idea might work though - I’ll give it a go :)

Edit: Yep - worked a treat. Thank you

1 Like

@Cathy_Sarisky @NikonUser Thank you for this post! I was looking to try to do something similar. ie. Create a staff-only section of my site.

Quick question:
I’m following Cathy’s tip to create a staff-only tier but am unable to make it cost $0. (The GUI complains and says, "Subscription amount must be at least $1.00". How did you guys work around this? The only thing I can think of is to configure a free trial period of 999999999999999 days. Is this what you guys did?

1 Like

There’s a complimentary subscription. You can make the price anything you want (well, apparently except for $0) and then give your staff users a forever-complimentary subscription.

3 Likes

Magnificent! Figured it out. Thank you, @Cathy_Sarisky!! :pray:

1 Like

Exactly how I did it as well.

I did put the subscription price at a very large number per month just in-case someone accidentally comes across it and signs up (and they are more than welcome to whatever content I put behind it for $9,999 per month :D )

2 Likes