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

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?

Best Answer

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

  • R_JR_J Admin

    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.

  • R_JR_J Admin

    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

    1. http://vanillaforums.org/discussions
    2. http://vanillaforums.org/discussions/participated
    3. http://vanillaforums.org/discussions/unanswered
    4. http://vanillaforums.org/profile/discussions/41252/netigate
    5. http://vanillaforums.org/profile/comments/41252/netigate
    6. http://vanillaforums.org/categories
    7. http://vanillaforums.org/categories/questions
    8. http://vanillaforums.org/bestof/everything

    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 ;-)

  • 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

  • netigatenetigate New
    edited July 2013

    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?

  • hgtonighthgtonight MVP
    edited July 2013

    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.

  • You could potentially use a jQuery selector to ass the css class,

    lol!!

Sign In or Register to comment.