• Register
    • Help

    striker  0 Items
    Currently Supporting
    • Home
    • News
    • Forum
    • Wiki
    • Support
      • Manage Subscriptions
      • FAQ
      • Support For
        • VaultWiki 4.x Series
        • VaultWiki.org Site
    • What's New?
    • Buy Now
    • Manual
    • 
    • Support
    • VaultWiki 3.x Series
    • Bug
    • Last Page not working correctly

    1. Welcome to VaultWiki.org, home of the wiki add-on for vBulletin and XenForo!

      VaultWiki allows your existing forum users to collaborate on creating and managing a site's content pages. VaultWiki is a fully-featured and fully-supported wiki solution for vBulletin and XenForo.

      The VaultWiki Team encourages you to join our community of forum administrators and check out VaultWiki for yourself.

    Issue: Last Page not working correctly

    • Issue Tools
      • View Changes
    1. issueid=2693 May 8, 2012 4:09 PM
      OKCTalk OKCTalk is offline
      Junior Member
      Last Page not working correctly

      I've enabled Wikivault in one of our forums that contain very long threads.

      When viewing the main forum page, the last page shown is not nearly the last page of the actual thread.


      For example, see the Devon Energy Center thread; on the main page of the forum it only shows up to page 410




      But when you click on page 410 you see the last page is actually 1023

    Issue Details
    Issue Number 2693
    Issue Type Bug
    Project VaultWiki 3.x Series
    Category Forum Display
    Status Fixed
    Priority 5 - Minor Bugs / Small Tweaks
    Affected Version 3.0.18
    Fixed Version 3.0.19
    Milestone (none)
    Software DependencyAny
    Users able to reproduce bug 0
    Users unable to reproduce bug 0
    Attachments 0
    Assigned Users (none)
    Tags (none)




    1. May 8, 2012 5:30 PM
      pegasus pegasus is offline
      VaultWiki Team
      Thanks for finding this. The issue here is that VaultWiki has a different setting for posts-per-page than regular threads, but the regular thread setting was still being applied in wiki forum thread bits.

      In vault/plugins/threadbit.php, find:
      Code:
      global $vbulletin;
      Add after:
      Code:
      	static $perpage;
      
      	if ($perpage == 0)
      	{
      		require_once(DIR . '/vault/functions.php');
      		$perpage = special_maxposts($pperpage);
      	}
      Reply Reply  
    2. May 8, 2012 6:14 PM
      OKCTalk OKCTalk is offline
      Junior Member
      Thanks for the reply.

      I made the change -- merely edited the .php file and replaced with new version -- and am still getting the same result.
      Reply Reply  
    3. May 8, 2012 6:29 PM
      pegasus pegasus is offline
      VaultWiki Team
      Okay, I see that more is needed. In the same file, find:
      Code:
      	if (!empty($thread['pagenav']) AND !VAULT_40X_COMPAT)
      	{
      		// redo multipage nav
      		$thread['totalposts'] = $thread['replycount']; // we don't use the + 1 because that's the article
      		$total =& $thread['totalposts'];
      
      		if ($thread['totalposts'] > $pperpage AND $vbulletin->options['linktopages'])
      		{
      			global $vbphrase;
      
      			$thread['totalpages'] = ceil($thread['totalposts'] / $pperpage);
      			$address = $thread['url_s'] . "do=comments";
      			$address2 = "$thread[highlight]";
      			$curpage = 0;
      
      			$thread['pagenav'] = '';
      			$show['pagenavmore'] = false;
      
      			while ($curpage++ < $thread['totalpages'])
      			{
      				if ($vbulletin->options['maxmultipage'] AND $curpage > $vbulletin->options['maxmultipage'])
      				{
      					$show['pagenavmore'] = true;
      					break;
      				}
      
      				$pagenumbers = fetch_start_end_total_array($curpage, $pperpage, $thread['totalposts']);
      				eval('$thread[pagenav] .= " ' . fetch_template('threadbit_pagelink') . '";');
      			}
      			unset($pagenumbers, $curpage, $address, $address2);
      		}
      		else
      		{
      			$thread['pagenav'] = '';
      		}
      	}
      Replace with:
      Code:
      	// redo multipage nav
      	$thread['totalposts'] = $thread['replycount']; // we don't use the + 1 because that's the article
      	$total =& $thread['totalposts'];
      
      	if ($thread['totalposts'] > $perpage AND $vbulletin->options['linktopages'])
      	{
      		global $vbphrase;
      
      		$thread['totalpages'] = ceil($thread['totalposts'] / $perpage);
      		$address = $thread['url_s'] . "do=comments";
      		$address2 = "$thread[highlight]";
      		$curpage = 0;
      
      		$thread['pagenav'] = '';
      		$show['pagenavmore'] = false;
      
      		while ($curpage++ < $thread['totalpages'])
      		{
      			if ($vbulletin->options['maxmultipage'] AND $curpage > $vbulletin->options['maxmultipage'])
      			{
      				if (VAULT_40X_COMPAT)
      				{
      					$lastpageinfo = array(
      						'page' => $thread['totalpages']
      					);
      
      					if ($thread['highlight'])
      					{
      						$lastpageinfo['highlight'] = urlencode(implode(' ', $thread['highlight']));
      					}
      
      					$thread['lastpagelink'] = fetch_seo_url('thread', $thread, $lastpageinfo, 'threadid', 'threadtitle');
      				}
      				$show['pagenavmore'] = true;
      				break;
      			}
      
      			$pagenumbers = fetch_start_end_total_array($curpage, $perpage, $thread['totalposts']);
      
      			if (VAULT_40X_COMPAT)
      			{
      				$pageinfo = array(
      					'page' => $curpage
      				);
      				if ($thread['highlight'])
      				{
      					$pageinfo['highlight'] = urlencode(implode(' ', $thread['highlight']));
      				}
      
      
      				$templater = vB_Template::create('threadbit_pagelink');
      					$templater->register('curpage', $curpage);
      					$templater->register('pageinfo', $pageinfo);
      					$templater->register('thread', $thread);
      				$thread['pagenav'] .= ' ' . $templater->render();
      			}
      			else
      			{
      				eval('$thread[pagenav] .= " ' . fetch_template('threadbit_pagelink') . '";');
      			}
      		}
      		unset($pagenumbers, $curpage, $address, $address2);
      	}
      	else
      	{
      		$thread['pagenav'] = '';
      	}
      Reply Reply  
    4. May 8, 2012 6:50 PM
      OKCTalk OKCTalk is offline
      Junior Member
      Okay it's working... With one small glitch.

      Notice my one ultra-long thread (Devon Energy Center: 1,023 pages) now has no page numbers at all:

      Reply Reply  
    5. May 8, 2012 7:59 PM
      pegasus pegasus is offline
      VaultWiki Team
      In the code posted above, try replacing this:
      Code:
      	$thread['totalposts'] = $thread['replycount'];
      With this:
      Code:
      	$thread['totalposts'] = preg_replace('#[^0-9]+#', '', $thread['replycount']);
      Reply Reply  
    6. May 8, 2012 8:07 PM
      OKCTalk OKCTalk is offline
      Junior Member
      Bingo!

      Thanks so much for the help and prompt replies.
      Reply Reply  
    + Reply

    Assigned Users
    Loading Please Wait
    Tags
    Loading Please Wait
    • Contact Us
    • License Agreement
    • Privacy
    • Terms
    • Top
    All times are GMT -4. The time now is 8:50 AM.
    This site uses cookies to help personalize content, to tailor your experience, and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Learn more… Accept Remind me later
  • striker
    Powered by vBulletin® Version 4.2.5 Beta 2
    Copyright © 2023 vBulletin Solutions Inc. All rights reserved.
    Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2023 DragonByte Technologies Ltd.
    Copyright © 2008 - 2013 VaultWiki Team, Cracked Egg Studios, LLC.