Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product
Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

How To remove #latest?

Comments

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

  • hgtonighthgtonight ∞ · New Moderator

    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.

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

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