Set permission to view an item's existence, but not its content
Posted
#3763
(In Topic #739)
Standard member

My website has a main_news block on the front page, and I've got a news category which consists of private content for a specific usergroup. I've set the category so that guests and members don't have view access, while the proper usergroup does, which works as expected. However, guests and members do not see the entry in the main_news block on the homepage.
I understand that this is expected behavior, as you normally don't want to offer a link to content that someone doesn't have permission to view, but in this case I'd like the restricted links to be visible in order to encourage people to sign up for the usergroup which does have permission. What would be the best way to accomplish this?
Posted
Site director

You'd need to alter the code in sources/blocks/main_news.php. Change has_category_access to true || has_category_access at both occurrences.
Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
- If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
- If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
- If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Posted
Standard member

1 guest and 0 members have just viewed this.

