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?
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.
@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?
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.
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 )