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.

Change the default - click Discussion go to the top post Item_1, instead of latest. Is this possible

abssorbabssorb New
edited May 2014 in Vanilla 2.0 - 2.8

I know the term is "discussion" so most people will want to see the latest comment. My users are old school forum users and like to go to Post No 1 when they click on a discussion title, they keep asking for this. Self-hosted v2.0.18.4

I couldn't find a forum option to do this, so I presume I'll need to modify some HTML?
I'd be grateful for any suggestions where to start :)

Comments

  • R_JR_J Ex-Fanboy Munich Admin
    edited May 2014

    Untested, but from principle it should work and be at least a good place to start at:

    <?php if (!defined('APPLICATION')) exit();
    
    $PluginInfo['NoLatestAnymore'] = array(
       'Name' => 'NoLatestAnymore',
       'Description' => 'Remove the "#latest" from discussion links in Recent Discussions' ,
       'Version' => '0.1',
       'RequiredApplications' => array('Vanilla' => '2.1'),
       'MobileFriendly' => TRUE,
       'Author' => 'Robin'
    );
    
    class NoLatestAnymorePlugin extends Gdn_Plugin {
       public function DiscussionsController_BeforeDiscussionName_Handler($Sender) {
          $Sender->EventArguments['DiscussionUrl'] = $Sender->EventArguments['Discussion']->Url;
       }
    }
    

    EDIT: you have to save that as /plugins/NoLatestAnymore/class.nolatestanymore.plugin.php

  • peregrineperegrine MVP
    edited May 2014

    of course since you are using 2.0.18.4, which you should upgrade

    you will also need to remove RequiredApplications' => array('Vanilla' => '2.1'),

    $Sender->EventArguments['DiscussionUrl'] = $Sender->EventArguments['Discussion']->Url;

    or maybe

    $Sender->EventArguments['DiscussionUrl'] = $Sender->EventArguments['Discussion']->Url . "/p1";

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited May 2014

    or try adding this line to your config.php

    $Configuration['Vanilla']['Comments']['AutoOffset'] = FALSE;

    and don't ever say the words "kitchen sink". it will make some users go stark raving mad. I learned my lesson here :)

    http://vanillaforums.org/discussion/comment/207970/#Comment_207970

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.