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.

Hide discussions from a specific Category

RaizeRaize ✭✭
edited November 2008 in Vanilla 1.0 Help
Helloo, I am using the BlogThis extension, so I would like to let members comment on posts which I "blog" but not have the posts from that category show up in the discussions view...any help?

Comments

  • This is the last thing I have to do before I can launch my forum...willing to paypal for any help :)
  • If you click 'block category' while viewing the 'Categories' list does it do what you need?
  • Yes, but it would have to be applied to all members that register.
  • @Minisweeper: That's exactly what I was requesting.

    Managed to achieve it using WallPhone's unrealeased (why?!) extension - Category Hider:

    <?php /* Extension Name: Category Hider Extension Url: http://www.lussumo.com/addons Description: Hides certian categories from the discussion grid Version: 1.0 Author: WallPhone Author Url: http://wallphone.com/ */ // CONFIGURATION: Edit the two array() statements in the code to reflect the category IDs that should be blocked. // The code blocks categories 5 and 6, but if you wanted to instead block categories 1, 3, and 6, then use // array('1', '3', '6') in place of the other two array functions. if ( ('index.php' == $Context->SelfUrl) && !in_array(ForceIncomingString('CategoryID', ''), array('5', '6')) ) { function Category_HideFromDiscussions(&$DiscussionManager) { $SB = &$DiscussionManager->DelegateParameters['SqlBuilder']; foreach ( array('5', '6') as $CurrentBlock ) { $SB->AddWhere('t', 'CategoryID', '', $CurrentBlock, '<>', 'and', '', 0, 0); } } $Context->AddToDelegate('DiscussionManager', 'PostGetDiscussionBuilder', 'Category_HideFromDiscussions'); $Context->AddToDelegate('DiscussionManager', 'PreGetDiscussionCount', 'Category_HideFromDiscussions'); } ?>

    WallPhone, I hope you don't mind me posting this code here, but this is really priceless! ;-)
  • Wow, thanks for finding that bro! Should I create a new extension and use that code?
  • Yes... or you could just download it from here.
  • I do have that written--complete with a little checkbox that you can set or clear to hide or show the category... no code hacking necessary any more. (which is the only reason I hadn't released it...)

    I could have sworn it was already up. I'll have to do some testing and uploading. It will require Vanilla 1.1.4 or later.
  • RaizeRaize ✭✭
    edited November 2008
    Holy crow, it works perfectly! I really owe you guys for this one, so if you want to whisper me your paypal id that's cool.

    The download link up there seems to be broken, so it's here in case anyone wants it before the official release by Wallphone:

    Category Hider v 1.0
  • It works for 2.0 ?
  • phreakphreak MVP
    edited March 2013

    For those coming via Google looking where to find a related plugin (link above is dead):

    Check peregrines: http://vanillaforums.org/addon/hidecategory-plugin

    • VanillaAPP | iOS & Android App for Vanilla - White label app for Vanilla Forums OS
    • VanillaSkins | Plugins, Themes, Graphics and Custom Development for Vanilla
Sign In or Register to comment.