Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-07-2017, 01:55 AM
chloe101 chloe101 is offline
 
Join Date: Dec 2007
Posts: 116
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to get Prev Post / Next Post working in 4.2.4?

Hi,

Each thread has a Prev Post/Next Post navigational feature. In the hybrid mode, it's right undr the hybrid window. Unfortunately, it's not working on my forum and I don't see any setting to control it.
When I hover above Prev Post/Next Post, there's a little message saying "javascript:showPreveNextPost(0)"

Have I overlooked a setting? Or is this a VBulletin error?

I already tried with add-on/hooks disabled. It still didn't work

Thank you!

On edit: The "Prev Post/Next Post" navigation works in the threaded view, but not the hybrid view. Is this something I should ask over at VB.com instead?
Reply With Quote
  #2  
Old 07-01-2017, 12:54 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So this turned out to be harder than I thought, and I know the solution isn't optimal because while the next/previous links will work in Hybrid mode it doesn't cache the post so the entire page reloads.

What you need to do is edit showthread.php file.

Find the line:

Code:
if ($threadedmode == 2) // hybrid display mode
And "comment it out" (make it)

Code:
//if ($threadedmode == 2) // hybrid display mode
then find the line

Code:
else // threaded display mode
and comment it out too...

Code:
//else // threaded display mode
Then save changes. (Maybe backup the original file first.)

In my testing the next/previous worked in Hybrid mode after these changes.
Reply With Quote
  #3  
Old 07-02-2017, 01:43 AM
chloe101 chloe101 is offline
 
Join Date: Dec 2007
Posts: 116
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
So this turned out to be harder than I thought, and I know the solution is optimum because while the next/previous links will work in Hybid mode it doesn't cache the post so the entire page reloads.
It worked!!! You rock! Thank you SO much :up:

--------------- Added [DATE]1498990892[/DATE] at [TIME]1498990892[/TIME] ---------------

Quote:
Originally Posted by BirdOPrey5 View Post
So this turned out to be harder than I thought, and I know the solution is optimum because while the next/previous links will work in Hybid mode it doesn't cache the post so the entire page reloads.

What you need to do is edit showthread.php file.

Find the line:

Code:
if ($threadedmode == 2) // hybrid display mode
And "comment it out" (make it)

Code:
//if ($threadedmode == 2) // hybrid display mode
then find the line

Code:
else // threaded display mode
and comment it out too...

Code:
//else // threaded display mode
Then save changes. (Maybe backup the original file first.)

In my testing the next/previous worked in Hybrid mode after these changes.
Oh dear. Next/previous worked great but unfortunately it duplicated all the posts in the thread creating a mirror copy underneath with the exact same post ids.

Also, when I retraced my steps to see if I'd done something wrong, I noticed there are two lines of

Code:
if ($threadedmode == 2) // hybrid display mode
one on line 1355 and one on line 1606

and two lines of

Code:
else // threaded display mode
one on line 1405 and one on line 1610

Can you please clarify which lines I should comment out in case that's what caused the duplication? The combinations I tried either duplicated all the posts or gave me errors.

I'm so sorry for coming back with a problem. Thanks for taking your time to help me. I really appreciate it.
Reply With Quote
  #4  
Old 07-02-2017, 12:14 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmmm, it would have been the first instance of each I edited. You can always copy an unedited file back from an original download zip if you need to restore back.
Reply With Quote
  #5  
Old 07-02-2017, 12:23 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

After restoring back to an original showthread.php file for VB 4.2.4 instead of the edits above instead do this edit-


Go to line 1356. after the { hit enter a few times for some blank lines.

Paste this code into the middle of the blank lines, save, and try again. I haven't tested it but I have a feeling it may work. Worst case you restore back to the original showthread.php file, it won't hurt anything.

PHP Code:
        $FIRSTPOSTID $curpostid;
        
$LASTPOSTID $curpostid;

        
// sort out which posts to cache:
        
if (!$vbulletin->options['threaded_maxcache'])
        {
            
$vbulletin->options['threaded_maxcache'] = 999999;
        }

        
// cache $vbulletin->options['threaded_maxcache'] posts
        // take 0.25 from above $curpostid
        // and take 0.75 below
        
if (sizeof($postorder) <= $vbulletin->options['threaded_maxcache']) // cache all, thread is too small!
        
{
            
$startat 0;
        }
        else
        {
            if ((
$curpostidkey + ($vbulletin->options['threaded_maxcache'] * 0.75)) > sizeof($postorder))
            {
                
$startat sizeof($postorder) - $vbulletin->options['threaded_maxcache'];
            }
            else if ((
$curpostidkey - ($vbulletin->options['threaded_maxcache'] * 0.25)) < 0)
            {
                
$startat 0;
            }
            else
            {
                
$startat intval($curpostidkey - ($vbulletin->options['threaded_maxcache'] * 0.25));
            }
        }
        unset(
$curpostidkey);

        foreach (
$postorder AS $postkey => $pid)
        {
            if (
$postkey > ($startat $vbulletin->options['threaded_maxcache'])) // got enough entries now
            
{
                break;
            }
            if (
$postkey >= $startat AND empty($morereplies["$pid"]))
            {
                
$cache_postids .= ',' $pid;
            }
        }

        
// get next/previous posts for each post in the list
        // key: NAVJS[postid][0] = prev post, [1] = next post
        
$NAVJS = array();
        
$prevpostid 0;
        foreach (
$postorder AS $pid)
        {
            
$NAVJS["$pid"][0] = $prevpostid;
            
$NAVJS["$prevpostid"][1] = $pid;
            
$prevpostid $pid;
        }
        
$NAVJS["$toppostid"][0] = $pid//prev button for first post
        
$NAVJS["$pid"][1] = $toppostid//next button for last post

        
$navjs '';
        foreach (
$NAVJS AS $pid => $info)
        {
            
$navjs .= "pn[$pid] = \"$info[0],$info[1]\";\n";
        }
    }

    unset(
$ipostarray$postparent$postorder$NAVJS$postid$info$prevpostid$postkey); 
(The above is code from threaded mode that I believe makes the next/previous links work.)
Reply With Quote
  #6  
Old 07-02-2017, 05:36 PM
chloe101 chloe101 is offline
 
Join Date: Dec 2007
Posts: 116
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
After restoring back to an original showthread.php file for VB 4.2.4 instead of the edits above instead do this edit- .....
Sadly no, I did that and got "Parse error: syntax error, unexpected 'else' (T_ELSE) in (...)/showthread.php on line 1477"

the error line, my 1477, is
Code:
else // threaded display mode
Reply With Quote
  #7  
Old 07-02-2017, 09:00 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, let me try playing with it a bit more, you're still on VB 4.2.4, right?
Reply With Quote
  #8  
Old 07-02-2017, 09:04 PM
chloe101 chloe101 is offline
 
Join Date: Dec 2007
Posts: 116
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
OK, let me try playing with it a bit more, you're still on VB 4.2.4, right?

Yes Still on 4.2.4. Thanks
Reply With Quote
  #9  
Old 07-10-2017, 01:58 AM
chloe101 chloe101 is offline
 
Join Date: Dec 2007
Posts: 116
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
OK, let me try playing with it a bit more, you're still on VB 4.2.4, right?
If it's too much of a pain to get this working, please don't feel obligated to spend a ton of time on it. Could you maybe help me instead to remove the previous/next post text on the hybrid page? Thanks
Reply With Quote
  #10  
Old 07-10-2017, 12:47 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Let's try this one more time before we go about removing the links. I tested this, seemed to work for me.

Again, edit an original showthread.php file.

Find this code:

PHP Code:
    }
    else 
// threaded display mode 
It's at or about line 1404 (the first instance of else // threaded display mode)

But also above the closing bracket }

So really, directly below this text in the file:

PHP Code:
        $pagenav construct_page_nav(
            
$vbulletin->GPC['pagenumber'],
            
$perpage,
            
$numhybrids,
            
'',
            
'',
            
'',
            
'thread',
            
$threadinfo,
            
$pageinfo
        
); 
Paste in the following code:

PHP Code:
        // get next/previous posts for each post in the list
        // key: NAVJS[postid][0] = prev post, [1] = next post
        
$NAVJS = array();
        
$prevpostid 0;
        foreach (
$postorder AS $pid)
        {
            
$NAVJS["$pid"][0] = $prevpostid;
            
$NAVJS["$prevpostid"][1] = $pid;
            
$prevpostid $pid;
        }
        
$NAVJS["$toppostid"][0] = $pid//prev button for first post
        
$NAVJS["$pid"][1] = $toppostid//next button for last post

        
$navjs '';
        foreach (
$NAVJS AS $pid => $info)
        {
            
$navjs .= "pn[$pid] = \"$info[0],$info[1]\";\n";
        } 

So in the end the code looks like:

PHP Code:
        $pagenav construct_page_nav(
            
$vbulletin->GPC['pagenumber'],
            
$perpage,
            
$numhybrids,
            
'',
            
'',
            
'',
            
'thread',
            
$threadinfo,
            
$pageinfo
        
);
        
        
        
// get next/previous posts for each post in the list
        // key: NAVJS[postid][0] = prev post, [1] = next post
        
$NAVJS = array();
        
$prevpostid 0;
        foreach (
$postorder AS $pid)
        {
            
$NAVJS["$pid"][0] = $prevpostid;
            
$NAVJS["$prevpostid"][1] = $pid;
            
$prevpostid $pid;
        }
        
$NAVJS["$toppostid"][0] = $pid//prev button for first post
        
$NAVJS["$pid"][1] = $toppostid//next button for last post

        
$navjs '';
        foreach (
$NAVJS AS $pid => $info)
        {
            
$navjs .= "pn[$pid] = \"$info[0],$info[1]\";\n";
        }
        
        
    }
    else 
// threaded display mode 
That is working for me, Please try it.
Reply With Quote
2 благодарности(ей) от:
chloe101, MarkFL
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:38 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.11296 seconds
  • Memory Usage 2,341KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (11)bbcode_code
  • (5)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (2)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete