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.
Options

Auto-Sink?

edited November 2011 in Vanilla 2.0 - 2.8
Hey gang,

I apologize in advance if this question has been answered in the past. I did try to search google before hand to see if this question was asked as i know you forum guys hate repeated questions :-P

In any case, is there a way to set vanilla forums to auto-sink posts? We actually use vanilla on my LAN at work and use it for things like closing notes. As of right now every time we make a new daily closing notes thread, i need to set it to sink right away. Any automatic solution for this? Thanks!

Answers

  • Options
    You can better write a plugin that either sets an extra checkbox "sink" next to the "close" checkbox or hooks into the process of closing the thread.

    There was an error rendering this rich post.

  • Options
    Learn the plugin basics

    You need to hook DiscussionController_Close_Before look at class.discussioncontroller.php for details.

    There is a close and a sink, you need to use the sink method in that hook.

    Using DiscussionModel_BeforeSaveDiscussion_Handler you can add the post values.

    Use your initiative.

    grep is your friend.

  • Options
    LincLinc Detroit Admin
    edited November 2011
    Make a plugin with this in it. Or, you could put it in your theme hooks file if you have a custom theme.

    public function PostController_DiscussionFormOptions_Handler($Sender) { $Sender->EventArguments['Options'] .= ''.$Sender->Form->CheckBox('Sink', T('Sink'), array('value' => '1')).''; }
  • Options
    Guys, thanks so much for all your help, I am not a coder though. Lincoln, thank you for your code. Can I just create a blank default.php using notepad/textedit with that text above and place it in the plugin's folder for it to work? Is there anything else that goes into plugin creation?
  • Options
    x00x00 MVP
    edited November 2011
    The checkbox way will allow you to opt out, but if you are close from the options menu rather from adding or editing, it won't sink automatically.

    @Lincoln it is a bit odd that way why would you sink if you are not closing?

    Plugin example:
    $PluginInfo['SinkAutoOption'] = array(
    'Name' => 'SinkAutoOption',
    'Description' => "SinkAutoOption description",
    'Version' => '0.1',
    'Author' => 'me'
    );

    class SinkAutoOption extends Gdn_Plugin {
    [code here]
    }

    grep is your friend.

  • Options
    LincLinc Detroit Admin
    @Lincoln it is a bit odd that way why would you sink if you are not closing?
    Sinking a closed discussion is redundant.
  • Options
    x00x00 MVP
    edited November 2011
    I misunderstood his question.

    So he basically want to sink as soon as he has added. Ok...

    grep is your friend.

  • Options
    X00 like i said but might have not stated clearly enough, we use the forum for closing notes, so in order to keep the newest dates at the top and dates in order going down the forum, we need sink enabled by default

    Closing Notes 11/12
    Closing Notes 11/11
    Closing Notes 11/10
    etc...

    Other wise if someone isn't in for two days and responds to a comment from the closing notes a few days ago it will bump the date back up to the top and thats really not what we want, rather have things organized.

    Not sure if this makes sense, let me know.
  • Options
    Ah this is more a blog format.

    grep is your friend.

  • Options
    x00 yes exactly! Sorry i couldn't think of how to describe it better, hehe.
  • Options
    @xentry
    Not trying to be a karma whore, but...
    The NillaBlog addon turns a category into a blog display, comments to blog posts to not raise the discussion to the top (IE: they are sorted on create time)

    I don't know if you're looking for the whole blog display of posts, but it may offer you a starting point for making your own addon.

    There was an error rendering this rich post.

  • Options
    karma whore is that better the a cameleon???

    grep is your friend.

  • Options
    way better :P

    There was an error rendering this rich post.

Sign In or Register to comment.