Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Hiding Posts
netigate
New
Hi,
i need some posts only be accessible for the ones who know the link. With other words i dont want some posts to show up in the category views. How can i hide posts?
0
Best Answer
-
hgtonight MVP
How do you want to select the posts that should not be shown? There are many ways.
I would put the "hidden" posts in a specific category. Then I would hook into the discussions view (using a theme hook), and not write any discussion with the hidden category. The links would still work fine for anyone that has it.
You could also just detect the discussion ID and remove it that way.
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
7
Answers
no idea?
Create a new role and set the permissions you want for the categories. Give the role to the users you want to see those categories. Remove the permissions for the categories from the roles you don't want to have access.
Add Pages to Vanilla with the Basic Pages app
that would be a good idea. though i would exclude all users who dont have certain user rights. the easiest would be to hide a post in the listing, maybe using css? but there is no selector i could use
If you use discussions for your plan but do not touch the permissions, you will have to make sure that no view at all links to your "secret" discussion and that includes also every reference in categores, dicussions, profile and in most addons, too.
Wouldn't it be easier to make it a conversation? You can add users to conversations and that is like telling someone the secret link, only that it is really secret.
the thing the post must be open to anybody, but shouldnt be shown in the overviews. only the ones who know the link should get access to it. regardless if they are logged in or not. is there a easy hack to add a css class to each discussion in the overviews? if i get them dissapeared there, i would have them hidden.
Okay, I hate it when someone asks "How can achieve A?" and somebody answers "Why A? Try B!", so I try to answer your question.
You would have to add a field "IsUnpublished" to discussion table and giving discussion authors a checkbox to mark a thread as "unpublished".
Afterwards, you'll have to make sure that no view at all shows this discussions. There are numerous views where discussions are shown. Those were the ones I found very quikly here at this forum
It might be easier to hook the appropriate models and to filter out the discussions from there.
You still have to look at every addon, because they might not use the discussion/category models at all but question the database information directly.
When you did hook the discussion model, you'll have to compare the url and if it is the url to your unpublished discussion, the filter you manually set must be ignored.
Sounds like a lot of work but that's the only solution I can think of.
But maybe you describe why you try to achieve something like this and somebody comes up with a "Try B!" that works for you ;-)
How do you want to select the posts that should not be shown? There are many ways.
I would put the "hidden" posts in a specific category. Then I would hook into the discussions view (using a theme hook), and not write any discussion with the hidden category. The links would still work fine for anyone that has it.
You could also just detect the discussion ID and remove it that way.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
thanks for all your replies. there are many good approaches now i can work on. i guess that could be a new feature of VF in the future
oh...lets consider a much more easier way. i just learned about theme hooks in this post at http://vanillaforums.org/discussion/23007/how-to-add-class-attribute-to-link-in-theme-hooks
wouldnt it be the easiest way if each thread/post gets an own css id? then i could just hide each post using css. wordpress does it with each post and even on the post-detail page.
how would i have to write a css hook?
You would have to hook in to the discussions view to add the css class, so you could just prevent it from being written at that point.
You could potentially use a jQuery selector to add the css class, but you could just hide or delete the node at that point.
EDIT - Freudian slip
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
lol!!
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌