Problem with pagination
Waleed Offline
Junior Member
**
Posts: 34
Joined: Feb 2013
Post: #1
Problem with pagination
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.
10-29-2015 02:20 PM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #2
RE: Problem with pagination
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.

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
(This post was last modified: 10-29-2015 06:26 PM by Sama34.)
10-29-2015 06:25 PM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #3
RE: Problem with pagination
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

10-30-2015 05:19 AM
Find all posts by this user Quote this message in a reply
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: 421)


[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
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #5
RE: Problem with pagination
Why did you removed $useronly from within the last if?

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
10-31-2015 12:12 PM
Visit this user's website Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #6
RE: Problem with pagination
oh yea. Missed that Smile


[Image: leelink.gif]
MYBB1.6 & XThreads
10-31-2015 07:23 PM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #7
RE: Problem with pagination
Maybe patch also the showthread breadcrumbs pagination?

11-01-2015 07:05 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #8
RE: Problem with pagination
I dont use it so I didnt patch it. Its the first thing I switch off.


[Image: leelink.gif]
MYBB1.6 & XThreads
11-01-2015 09:29 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #9
RE: Problem with pagination
Yeah, I should agree that it is not very useful.
Oh, BTW, it is already "fixed" by XThreads.

(This post was last modified: 11-01-2015 11:06 AM by RateU.)
11-01-2015 11:02 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #10
RE: Problem with pagination
yea, I see ZB has updated on github. Smile


[Image: leelink.gif]
MYBB1.6 & XThreads
11-01-2015 11:37 AM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: