Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Hiding Discussions...

JasonPJasonP
edited May 2007 in Vanilla 1.0 Help
Alright so I'm working up an extension that allows a user to click [hide] next to any discussion, and then they can no longer see it unless select Hidden Discussions from the Discussion Filters in the panel. I'm reasonably far along, but getting Vanilla to actually hide the discussion seems trickier than I first imagined. I have a new DB setup that holds a list of the user hidden discussion ids. This part all works. Now I need to filter out the results, blocking any discussion id in that set. My first thought was to alter the data in the DiscussionGrid's PreRender() delegate, but its working with a mysql resource pointer instead of actual data. This doesn't get used until we are already in the theme itself, disussions.php. So, given a list/array of discussion ids to hide, how would one approach this easily?

Comments

  • I might be getting confused a bit here but you do know that vanilla does this by default? You would have to have a addon that allows users to view the hidden discussions via a link but when you delete a topic in vanilla it "hides" the discussion.

    The admin can then give permissions for others to view hidden discussions.

    So you can work off that.
  • I think what Jason wants is a per-user hiding system. At least, that was the impression I got.

    Can you perhaps append the query, by getting the SQL builder and add a WHERE to it?
  • bjrn has it in a nutshell. Well, I need to test for a value in a set then via SQL. First I don't know how, second I don't see much documentation on the SQL builder...
  • Here is an example of using SqlBuilder to hide categories from the discussions page: Hiding categories and still keeping posting privelages # 8

    It would be very simple to adapt that to hide by discussion IDs instead of CategoryIDs.

    Note that its probably better to use a for loop than a foreach, as foreach moves a position pointer through the array, and I found that if you follow the foreach with a second one without resetting it, it starts at the end of the array. (hence the two separate lines you to edit in my posted example) Count($Array) will return the number of items.
  • Perfect! Thanks much Wallphone.
  • edited May 2007
    I love the idea of this as a new per-user status. Would it still be searchable? If so, that might work great with a new extension being developed by MySchizoBuddy

    http://lussumo.com/community/discussion/6283/discussion-expiry/#Item_14

    The "expired" item would be hidden but still searchable.

    Couple of questions:
    Would Stickies be allowed to be hidden? What happens when a post is commented on or edited? Does it become "unhidden"?
This discussion has been closed.