HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

How to disable Auto offset in Vanilla Forums?

jaceoutjaceout New
edited October 2019 in Vanilla 3.x Help

I'm trying to disable auto offset (When we open post for the second time as a login user its automatically jump to the comment section and i don't want this) i don't know why Vanilla has included this in their script.

I want a clear and direct answer and not any random text.

Comments

  • I want a clear and direct answer and not any random text.


    Clear answer ...from my opinion:

    a logged in user is following stuff, staying up to date to the latest gist. Many chat/forum softwares handle this differently.

    I guess it can be made a bit smarter: "latest" for a logged-in user would be up-to what they have read.

    So if a logged-in user has never opened a discussion before, it makes little sense to transport said user to the last comment.

    Also, if a logged-in user is reading up on a discussion, and has not read the last 20 ... it makes more sense to attach that "latest" to where the user stopped last. But this might be too expensive for PHP who knows.

    This reminds me, a Smart Latest plugin is over due ... hmm!

    Nuke with PHP config

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

    Nuke it with Javascript if the above fails.

    $('.Title').find('a').each(function() {
     this.href = this.href.replace(/(#latest)/,"");
    });
    

    For your esteemed entertainment, read

    https://open.vanillaforums.com/discussion/22802/vanilla-2-1-how-to-remove-the-latest-from-the-end-of-discussion-urls


    Random Answer

    To be, or not to be, that is the question:

    Whether 'tis nobler in the mind to suffer

    The slings and arrows of outrageous fortune,

    Or to take arms against a sea of troubles....

  • I tried both of them its not working.

    Can you tell me the specific location (File) where Vanilla developer have integrated Auto Offset.

  • Look for AutoOffset in:

    \vanilla-3.2\applications\vanilla\controllers\class.discussioncontroller.php
    \vanilla-3.2\applications\vanilla\settings\configuration.php
    

    But that is a useless idea to meddle with any core file.

    The JavaScript code works and must work. If you test it on this forum from the browser's console, it works like a charm.

    The question you should ask is: where do I put the code?

    In your template /themes/myTemplate/views/default.master.tpl place before the ending body tag

    <script>
    $('.Title').find('a').each(function() {
     this.href = this.href.replace(/(#latest)/,"");
    });
    </script>
    

    Or in your config.php

    $Configuration['Vanilla']['Comments']['AutoOffset'] = FALSE;
    
  • Its Worked..... i have 1 more question Can i place this javascript code in core file instead of themes.

  • whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP

    Why would you want to do that?

    Any changes made in core are almost certain to be over-written by updates, so you would need to repeat the changes each update.

Sign In or Register to comment.