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.

How To remove #latest?

how to remove this #latest

Tagged:

Comments

  • do you want to remove the function of it (moving straight to the last comment) or only remove it from the url?

  • Welcome to the community!

    You can disable the #latest hash by disabling Auto Offset. Please add $Configuration['Vanilla']['Comments']['AutoOffset'] = FALSE; to your /conf/config.php file.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • @hgtonight said:
    Welcome to the community!

    You can disable the #latest hash by disabling Auto Offset. Please add $Configuration['Vanilla']['Comments']['AutoOffset'] = FALSE; to your /conf/config.php file.

    Is there a way to replace the #latest with a different string such as "?#oranges"..
    I am currently using javascript to replace #latest in url and then redirecting the browser back...

  • RiverRiver MVP
    edited September 2016

    @okhawaja said:

    @hgtonight said:
    Welcome to the community!

    You can disable the #latest hash by disabling Auto Offset. Please add $Configuration['Vanilla']['Comments']['AutoOffset'] = FALSE; to your /conf/config.php file.

    Is there a way to replace the #latest with a different string such as "?#oranges"..
    I am currently using javascript to replace #latest in url and then redirecting the browser back...

    no, not via config.php in vanilla 2.1 or before. But then again your question has nothing to do with the discussion or the title of the discussion.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

  • @okhawaja

    You can create a plugin that consist of
    a) the PluginInfo array
    b) an empty plugin class declaration and
    c) an altered copy of the anchor function

    Simply copy the anchor function from functions.render.php below the class and add

            if (strtolower(substr($Destination, -7)) === '#latest') {
                $Destination = substr($Destination, 0, -7).'#oranges';
            }
    

    just before the return '<a href=" line.

    As soon as you activate that plugin, your custom anchor function will be used, which will do the replacement you've asked for.

    But if that #oranges is only available in the discussion and not in comments, you might have problems with longer discussions, since without the config setting mentioned above by hgtonight, longer discussions will open on their last page.

  • @hgtonight said:
    Welcome to the community!

    You can disable the #latest hash by disabling Auto Offset. Please add $Configuration['Vanilla']['Comments']['AutoOffset'] = FALSE; to your /conf/config.php file.

    I tried what you said but it is not working for 2.2.
    Any idea on what I can do?

Sign In or Register to comment.