Problem with pagination
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #4
RE: Problem with pagination
I use frostschutz's patches plugin with the attached patch to fix this issue. This is what the code was prepatch:

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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");
        }
    }
}



Attached File(s)
.zip  patches.zip (Size: 1,013 bytes / Downloads: 453)


[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 10-30-2015 07:25 PM by leefish.)
10-30-2015 07:22 PM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Problem with pagination - Waleed - 10-29-2015, 02:20 PM
RE: Problem with pagination - Sama34 - 10-29-2015, 06:25 PM
RE: Problem with pagination - RateU - 10-30-2015, 05:19 AM
RE: Problem with pagination - leefish - 10-30-2015 07:22 PM
RE: Problem with pagination - Sama34 - 10-31-2015, 12:12 PM
RE: Problem with pagination - leefish - 10-31-2015, 07:23 PM
RE: Problem with pagination - RateU - 11-01-2015, 07:05 AM
RE: Problem with pagination - leefish - 11-01-2015, 09:29 AM
RE: Problem with pagination - RateU - 11-01-2015, 11:02 AM
RE: Problem with pagination - leefish - 11-01-2015, 11:37 AM

 Standard Tools
Forum Jump: