Previous Thread
Next Thread
Print Thread
Hop To
Joined: May 2004
Posts: 26
B
newbie
newbie
B Offline
Joined: May 2004
Posts: 26
I am running UBBT 6.5. Recently, I went through and "kept" a bunch of threads so that when I prune threads from the control panel, it would not prune the kept threads. However, whether or not I check or uncheck the "Exclude Kept Topics" in the "Prune Topics" section, I still get the exact same number of topics to prune. It acts like its ignoring the "Exclude Kept Topics" check box. Anyone have any idea what's going on or how to fix it?

Thanks,
Basil

Joined: Jun 2006
Posts: 182
A
member
member
A Offline
Joined: Jun 2006
Posts: 182
In /admin/selectprunethreads.php

search for:
$savequery .= " AND t1.B_Kept <> '1' ";

replace with:
$savequery .= " AND t1.B_Kept <> 'K' ";

Joined: May 2004
Posts: 26
B
newbie
newbie
B Offline
Joined: May 2004
Posts: 26
Thanks! That fixed "that" problem, but now have a different but related problem.

EXAMPLE: If I do a search to prune threads that are between two dates, but I [:"red"]do not[/] check the "[:"green"]Exclude Kept Threads[/]" then I get all the threads that are between the two dates I picked, which is as it should be. Lets say that there are 34 total threads between those two dates. In this case, I get two pages of threads to prune (20 on the first page and 14 on a second page).

BUT. Lets say I have 4 Kept Threads in that date range. Then, if [:"blue"]I check[/] the "[:"green"]Exclude Kept Topics[/]" check box, you would expect it to return 30 threads (the original 34 minus the 4 that are excluded because they are kept.)

WHAT IS HAPPENING: When I check the "[:"green"]Exclude Kept Topics[/]" box (all other boxes unchecked) and to the search, it says that "30" topics were found, as I would expect, but [:"red"]only ONE (1) page[/] of topics (20 topics) is shown when I click the "[:"green"]Let me review the selected topics first[/]" link.

In other words, the search says it found 30 topics (all between the two dates minus the "kept topics"), but when you list them, it only shows one page of topics (20 topics) and you [:"red"]do NOT get the second page[/] (which in this case should contain 10 additional topics).

Basil

Joined: Jun 2006
Posts: 182
A
member
member
A Offline
Joined: Jun 2006
Posts: 182
same script,

search for:
$totalpages = floor($total/20);

replace with:
$totalpages = floor($total/20) + 1;

search for:
$start = (($p -1) * 20) - 1;

replace with:
$start = (($p -1) * 20);

Joined: May 2004
Posts: 26
B
newbie
newbie
B Offline
Joined: May 2004
Posts: 26
I determined also that the problem was in the use of the floor function. However, correct me if I'm wrong, but you ONLY want to add +1 to $total pages IF there is a fractional part in ($total/20) which gets lost with the floor function. Based on that assumption, I tried this and it seems to work:

Same script:

Find: $totalpages = floor($total/20);

add before this line:
$testtotal = ($total/20);

and add after the line:

if($testtotal > $totalpages)
$totalpages++;

so that it looks like this:

$testtotal = ($total/20);
$totalpages = floor($total/20);

if($testtotal > $totalpages)
$totalpages++;

This will add 1 to $totalpages only IF there is a fractional part.

Now that I have the correct number of pages showing, there is also a problem with the variable $total.

Example: If you choose to prune posts between two dates, and don't check the manual prune box, it will tell you
"You have chosen to prune "X" topics", but then if you click the "Let me review the selected topics first" you find that the actual number of posts returned that meet the critera is actually X+1. In other words, if it tells you "You have chosen to prune 41 topics" what you actually get in the list of topics is 42 topics (all of which do meet the select criteria). In other words, the number of topics it tells you have been selected, is always one less than truth.

Basil

Joined: Jun 2006
Posts: 182
A
member
member
A Offline
Joined: Jun 2006
Posts: 182
> but you ONLY want to add +1 to $total pages IF there is a fractional part in ($total/20)

You are right, it should be
$totalpages = ceil($total/20);


>" what you actually get in the list of topics is 42 topics


This is fixed by
search for:
$start = (($p -1) * 20) - 1;

replace with:
$start = (($p -1) * 20);

Joined: May 2004
Posts: 26
B
newbie
newbie
B Offline
Joined: May 2004
Posts: 26
By George, I think you've got it! <img src="https://www.ubbcentral.com/boards/images/graemlins/smile.gif" alt="" />


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
PHP 8 bug in membermanage.tmpl
by phoenix011235 - 09/08/2026 7:47 PM
Are any of these legitmate?
by Baldeagle - 09/06/2026 1:37 PM
After server reboot
by Morgan - 09/02/2026 8:27 AM
Email Settings
by Outdoorking - 05/13/2026 2:44 AM
Who's Online Now
1 members (1 invisible), 304 guests, and 96 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Ride safe!
Ride safe!
by Morgan, December 7
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20260527)