UBB.Dev
Posted By: IAmBodhi Reverse Posting Hack Needed! - 11/05/2002 7:08 PM
How do i reverse the posts within a thread so that it goes from newset to oldest? People have grown VERY accustomed to this from UBB Classic and area already complaining.

In other words, I want the very first post in a thread to appear last, so that the newest replies are always on top. The Dateslip only works to move the most recent threads to the top of the list.

I'd hire someone if i have to; i need to get this done ASAP.

Thanks!

Peace,
Keith
Posted By: AllenAyres Re: Reverse Posting Hack Needed! - 11/05/2002 7:39 PM
welcome keith

that's an unsual request. Can it be done with ubb.classic? I've never tried that

With threads' threaded view taken into consideration, I imagine this will be a difficult task, tho I could be wrong and it might be a 1-line change You might also post this in the 'forhire' forum if you are interested in a developer writing it for you
Posted By: IAmBodhi Re: Reverse Posting Hack Needed! - 11/05/2002 9:05 PM
Yes, in UBB Classic, it's just a click of a button. Some posts have 50 - 100 replies, and it gets difficult to have to scroll through all the pages to find the latest post when the thread order is NOT reversed, especially if you've been following the thread closely...

I'll try to find the "For Hire" section. Anyone interested in looking into this, please e-mail me; it's important for me to get this done, or i have to switch back to Classic.

Sincerely,
Keith
[][email protected][/]
Posted By: JoshPet Re: Reverse Posting Hack Needed! - 11/05/2002 9:23 PM
Now with threads... even in flat view....
you won't need to scroll.....

Threads always jumps to the first unread post for you in the thread.

I'll look into this tonight though...and see if I can figure it out. Might be beyond me though.
Posted By: JoshPet Re: Reverse Posting Hack Needed! - 11/06/2002 4:00 AM
Not sure about Showthreaded view yet....

But if I undersand this correctly... for example in showflat... you want the most recent reply to be at the top of the page.... if there are 5 pages in the thread.... page 5 will contain the initial post? If so, it's very simple in showflat.php.

I'm not sure how this will react with other features (like when it tries to jump to the newest post etc...). You'll have to test it out.

I'll continue to look at showthreaded.php, but that doesn't exactly order by date... <SHRUG>

code:

In showflat.php

Find this:

// -----------------------
// Cycle through the posts
$query = "
SELECT t1.B_Number,t1.B_Username,t1.B_Posted,......
FROM {$config['tbprefix']}Posts AS t1,
{$config['tbprefix']}Users AS t2
WHERE t1.B_Main = '$current'
AND t1.B_PosterId = t2.U_Number
$Viewable
ORDER BY B_Number
$Limit
";


Change to this:

// -----------------------
// Cycle through the posts
$query = "
SELECT t1.B_Number,t1.B_Username,t1.B_Posted,......
FROM {$config['tbprefix']}Posts AS t1,
{$config['tbprefix']}Users AS t2
WHERE t1.B_Main = '$current'
AND t1.B_PosterId = t2.U_Number
$Viewable
ORDER BY B_Number [:"red"]DESC[/]
$Limit
";


[i]Note: I reduced the length of the "SELECT" statement to prevent scrolling here. But it's the only place that says "Cycle through the Posts".
Posted By: JoshPet Re: Reverse Posting Hack Needed! - 11/06/2002 4:43 AM
Threaded view is an animal that just doesn't seem compatible with this type of scheme.

Threaded view is designed to work off of the main post. so it always comes up to the FIRST post in the thread...then list all the replies. But the replies aren't exactly by date to begin with... they are first shown by what exact post they are in reply to.

I was able to easily accomplish the switch in how the replies are sorted... but given the nature of threaded view... reordering the replies really doesn't make sense.

If you want to try it....

code:

in showthreaded.php

Find this:

// --------------------------------------
// Grab all of the replies in this thread
$query = "
SELECT B_Number,B_Parent,B_Posted,B_Username,...
FROM {$config['tbprefix']}Posts
WHERE B_Main=$current
$Viewable
ORDER BY B_Number DESC


Change to this:

// --------------------------------------
// Grab all of the replies in this thread
$query = "
SELECT B_Number,B_Parent,B_Posted,B_Username,....
FROM {$config['tbprefix']}Posts
WHERE B_Main=$current
$Viewable
ORDER BY B_Number [:"red"]ASC[/]




Hopefully that's helpful for you.

My guess... if you are switching from Classic... then the users will most likely enjoy the "flat mode" better anyway.... that works the most logical reversing the sort by date.



If you wanted to get deeper and make it an option... this could be added (with some deeper integration) as an option people could choose from the display preferences in their profile... or a config option.

Otherwise... it *should* work fine.
Posted By: IAmBodhi Re: Reverse Posting Hack Needed! - 11/06/2002 8:55 AM
WOW! - It worked like a dream, and it only took adding a single word. You have made about 300 people over at my place VERY happy.

How do i say thanks?

Also, how do i go about inquiring getting this added as a "for hire" option to my threads? - This is something i always wished UBB had an option for...to choose your OWN thread order. This is a serious inquiry.

Sincerely,
Keith

P.S. I also want to find out about what it might cost to get someone to add the subcription service to my ubbthreads...
Posted By: JoshPet Re: Reverse Posting Hack Needed! - 11/06/2002 9:04 AM
Great glad it works for ya!

When you say how do you go about getting this added as a "for hire" option....
I think you mean how do you request it to be a standard threads feature?

Infopop does track and log feature requests posted here at InfoPop community.

However, as you've learned... the tweak for that was simple... and thus as you upgrade etc... you'll need to re-add that tweak in each time.

When we talk about "for hire", we have a forum here for people looking for things developed etc... complex modifications or custom scripts. Some of us will install modifications etc.. that you see here if the task seems too complicated for you.

But otherwise, what you see here... including the tweak I posted is a community effort to help make users' boards better... and there's no charge for that.

Glad you've got some happy users on your hands.

Josh
Posted By: IAmBodhi Re: Reverse Posting Hack Needed! - 11/06/2002 9:52 AM
Such kindness...i'm not used to that!

I think that what i wanted to do next IS a "for hire" thing:

[]If you wanted to get deeper and make it an option... this could be added (with some deeper integration) as an option people could choose from the display preferences in their profile... or a config option.[/]
Am i correct? If so, do i post that in the "for hire" section or talk with you about it...sorry, a complete newbie am i.

Peace,
Keith
© UBB.Developers