MyBB Hacks

Full Version: Problem with pagination
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey.

So I'm using the YTV gallery application on my forum

http://sharree.com

Here's the issue:

On the homepage it displays 3 pages, which is correct
http://sharree.com/forumdisplay.php?fid=3

However when I go to the prefix links the pagination still displays 3 pages, even though there should only be one.
http://sharree.com/forumdisplay.php?fid=3&prefix=2

Any ideas what the problem is here?
It's not a theme issue because I've tested three other themes and still doing it.
IIRC somebody already reported this here. Can't remember if this has been already fixed, are you using the last version of MyBB? If so, it hasn't probably been fixed then.
Yeah, that is the MyBB pagination issue for counting the threads.
Look at this example:
http://community.mybb.com/forum-104-page...http://community.mybb.com/forum-104-page-4.html
The pagination is still showing 33 pages.

Reference:
http://mybbhacks.zingaburga.com/showthread.php?tid=5241
I use frostschutz's patches plugin with the attached patch to fix this issue. This is what the code was prepatch:

PHP Code:
if($fpermissions['canviewthreads'] != 0)
{
// How many posts are there?
if(($datecut > 0 && $datecut != 9999) || isset($fpermissions['canonlyviewownthreads']) && $fpermissions['canonlyviewownthreads'] == 1)
{
$query = $db->simple_select("threads", "COUNT(tid) AS threads", "fid = '$fid' $useronly $visibleonly $datecutsql $prefixsql");
$threadcount = $db->fetch_field($query, "threads");
}
else
{
$query = $db->simple_select("forums", "threads, unapprovedthreads, deletedthreads", "fid = '{$fid}'", array('limit' => 1));
$forum_threads = $db->fetch_array($query);
$threadcount = $forum_threads['threads'];
if($ismod == true)
{
$threadcount += $forum_threads['unapprovedthreads'] + $forum_threads['deletedthreads'];
}
// If we have 0 threads double check there aren't any "moved" threads
if($threadcount == 0)
{
$query = $db->simple_select("threads", "COUNT(tid) AS threads", "fid = '$fid' $useronly $visibleonly", array('limit' => 1));
$threadcount = $db->fetch_field($query, "threads");
}
}
}


and post patch

PHP Code:
if($fpermissions['canviewthreads'] != 0)
{
    // How many posts are there?
    if($datecutsql || $useronly || $prefixsql)
    {
        $query = $db->simple_select('threads', 'COUNT(tid) AS threads', "fid='{$fid}'{$useronly}{$visibleonly}{$datecutsql}{$prefixsql}", array('limit' => 1));
        $threadcount = $db->fetch_field($query, "threads");
    }
    else
    {
        $query = $db->simple_select("forums", "threads, unapprovedthreads, deletedthreads", "fid = '{$fid}'", array('limit' => 1));
        $forum_threads = $db->fetch_array($query);
        $threadcount = $forum_threads['threads'];
        if($ismod == true)
        {
            $threadcount += $forum_threads['unapprovedthreads'] + $forum_threads['deletedthreads'];
        }

        // If we have 0 threads double check there aren't any "moved" threads
        if($threadcount == 0)
        {
            $query = $db->simple_select('threads', 'COUNT(tid) AS threads', "fid='{$fid}'{$visibleonly}", array('limit' => 1));
            $threadcount = $db->fetch_field($query, "threads");
        }
    }
}

Why did you removed $useronly from within the last if?
oh yea. Missed that Smile
Maybe patch also the showthread breadcrumbs pagination?
I dont use it so I didnt patch it. Its the first thing I switch off.
Yeah, I should agree that it is not very useful.
Oh, BTW, it is already "fixed" by XThreads.
yea, I see ZB has updated on github. Smile
Reference URL's