vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB5 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=263)
-   -   go to new post link (https://vborg.vbsupport.ru/showthread.php?t=322711)

nelsantiago 05-24-2016 03:55 PM

go to new post link
 
If I want to add a go to last post like
Code:

?goto=newpost
to the end of a search result, how would I go about doing that?

Here's the page in question
http://www.vdubaddiction.com/forums/splashpage

my users would like to have the latest topic links go to the last response. I know the code above will do that. But I'm not sure where to put it.

Thanks!

noypiscripter 05-24-2016 04:01 PM

The >> icon in the Last Post column already does that.

nelsantiago 05-24-2016 04:13 PM

I'm aware of that. They'd like the link itself to do that. Just like phpBB can.

noypiscripter 05-25-2016 06:10 AM

You need to create a template hook at footer_before_body_end hook location. Then the template code to use is below:

Code:

<script>
(function($) {
        var $container = $('#widget_182');
        if ($container.length) {
                $('.go-to-last-post', $container).each(function() {
                        var $this = $(this),
                                $postTitleLink = $this.closest('.js-topic-item').find('.js-topic-title');

                        $postTitleLink.attr('href', $this.attr('href'));
                });
        }
})(jQuery);
</script>

That will update the URL of the post title to be the same as that of the Go to Last Post icon. This will apply to the "Latest Updated Topics" module only which has id of widget_182. If you want to apply it everywhere, then just change:

Code:

var $container = $('#widget_182');
to:

Code:

var $container = $('.topic-list-container');

nelsantiago 05-25-2016 12:49 PM

Do I need to clear the cache on the board cause that did nothing. Hopefully I followed the instructions correctly. See below

https://vborg.vbsupport.ru/external/2016/05/4.png

noypiscripter 05-25-2016 05:51 PM

You need to create a new template named go_to_last_post under the theme/style that you're using and paste the code there not in that last field (Hook Arguments) which you should leave empty.

nelsantiago 05-25-2016 07:16 PM

You sir, Are a genius! that was it. Sorry it wasn't clear that I had to make those two separately. Worked like a charm. Thank you. One last question. So now that it's going to last post, what would I need to do to make it go to last unread post? BTW This thread should be helpful to sooo many people. I've seen this question asked a lot of times in the archives with no real solution until now. Fantastic!


All times are GMT. The time now is 10:14 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01689 seconds
  • Memory Usage 1,724KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete