PDA

View Full Version : Chatter Box: Reverse Thread?


CocteauBoy
06-09-2004, 07:05 PM
Is there a way to reverse the thread of the Chatterbox posts so that the most recent is at the bottom? I was thinking that would make more intuitive sense to readers and posters.

Should I just start signing my name as: "painintheass"? LOL

troy

Ziad
06-09-2004, 07:10 PM
Open this file: subdreamer/plugins/p7_chatterbox/chatterbox.php

Find this code on line 70:
ORDER BY commentid DESC LIMIT 0, $limit");

Replace that with this new code:

ORDER BY commentid ASC LIMIT 0, $limit");

That should work :)

CocteauBoy
06-09-2004, 08:09 PM
That seems so obvious now. I really apologize for what must seem like such a nuisance, but you are really making a difference. And as that other person said, you are the best customer service EVER! -troy

CocteauBoy
06-10-2004, 01:51 AM
Hey, guess what... when I change the code to ASC, it pushes the new posts out of viewing range while leaving the older posts at the top. Is there a way to make the older posts push out of range, instead of the new ones not showing up? (and is there a way to edit the posts if someone gets crazy and i want to delete?)

THANKS!

Troy

CocteauBoy
06-10-2004, 09:23 AM
(is there a way to edit the posts if someone gets crazy and i want to delete?)

THANKS!

Troy

Well it looks like deleting all of the _vt folders may have corrected the issue of the posts scrolling downward, etc. (thank goodness!)

So my only question now is whether I can edit any of the posts somehow...

Troy

Ziad
06-10-2004, 01:11 PM
You can delete them through the admin panel (Plugins->Chatterbox).

CocteauBoy
06-10-2004, 05:18 PM
You can delete them through the admin panel (Plugins->Chatterbox).

OMG, I didn't even realize that was down there... I hadn't scrolled all the way down! D'oh!

Thanks!

t

CocteauBoy
06-11-2004, 07:00 PM
Subduck, I guess my original situation is still true, where the ASC works, but only up to the number of posts I have set as allowed to show, but then the new posts beyond that do not show up. They are there, but I suppose they are registering "below" the comments field. I can see the posts in my admin view, but on the actual site, only the set number of posts remain unchanged with the new posts.

I hope that made sense.

Troy

Saikou
06-11-2004, 08:25 PM
Sorry to butt in :)

This should fix your problem CocteauBoy:
First, open your chatterbox.php plugin file, and find this section of code:

while($post = $DB->fetch_array($getposts))
{
$username = $post['username'];
$comment = $post['comment'];

if($wordwrap != 0)
{
$username = wordwrap($username, $wordwrap, "<br />", 1);
$comment = wordwrap($comment, $wordwrap, "<br />", 1);
}

if($smileys)
{
$comment = AddSmilies($comment);
}

echo "<b>$username</b><br />$comment<br /><br />";
}


Then, replace all of that with this:

// Create arrays holding all the comments/usernames we need to display
$rev_index = 0;
while($post = $DB->fetch_array($getposts))
{
$usernames[$rev_index] = $post['username'];
$comments[$rev_index] = $post['comment'];
$rev_index ++;
}

// Now output the array in reverse order
for ($out_index = $rev_index - 1; $out_index >= 0; $out_index --)
{
$username = $usernames[$out_index];
$comment = $comments[$out_index];

if($wordwrap != 0)
{
$username = wordwrap($username, $wordwrap, "<br />", 1);
$comment = wordwrap($comment, $wordwrap, "<br />", 1);
}

if($smileys)
{
$comment = AddSmilies($comment);
}

echo "<b>$username</b><br />$comment<br /><br />";
}


Hopefully that's what you're after :)

Oh, also, in order for this method to work correctly, the code on line 70 as noted in the earlier posts should remain as:

ORDER BY commentid DESC LIMIT 0, $limit");

CocteauBoy
06-11-2004, 09:12 PM
Thank you SAIKOU!! I will try that!! You guys are so great around here!

In regard to your last paragraph: Subduck had given me a replacement code that replaced the DESC with ASC (because I want the posts to show in in sequential order, so the most recent would be at the bottom). You are saying I should leave it as DESC?

Troy

Ziad
06-11-2004, 10:00 PM
Thanks Saikou :)

Yup I think you need to switch it back to DESC.

CocteauBoy
06-11-2004, 11:27 PM
You two are GENIES!!! THANK YOU SO MUCH!! I love this place! I am going to be offline until Tuesday, so I am very happy to get this corrected.

Troy

Leif André
07-10-2004, 03:30 PM
Hi.

I just realised that when I use the chatterbox on different pages, there are different messages on each page. I would like the same messages to show up on all pages i use the chatterbox in.

Maybe there could be a targeting option (like for the latest news)? If it was set to "No", the latest messages would display no matter which page/category they were created on...?

Ziad
07-10-2004, 04:10 PM
ok :)

Leif André
07-11-2004, 05:51 AM
Since maybe other people like to know what to do to get the chatterbox to show the same latest comments on all pages, I'll write the code here. Open the chatterbox.php under the folder p7_chatterbox:

Find this code on line 29/30:
$lastentry = $DB->query_first("SELECT username, comment FROM " . TABLE_PREFIX . "p7_chatterbox WHERE categoryid = '$categoryid'
ORDER BY commentid DESC LIMIT 0, 1");
and change to this:
$lastentry = $DB->query_first("SELECT username, comment FROM " . TABLE_PREFIX . "p7_chatterbox
ORDER BY commentid DESC LIMIT 0, 1");
And this code on line 74/75:
$getposts = $DB->query("SELECT username, comment FROM " . TABLE_PREFIX . "p7_chatterbox WHERE categoryid = '$categoryid'
ORDER BY commentid DESC LIMIT 0, $limit");
should be changed to this:
$getposts = $DB->query("SELECT username, comment FROM " . TABLE_PREFIX . "p7_chatterbox
ORDER BY commentid DESC LIMIT 0, $limit");
Worked on my site, so this should be correct. :D Or you might want to wait on Subduck to add the targeting option in SD 1.1.5 ;)

CocteauBoy
10-20-2004, 06:13 PM
I've now implemented the REVERSE thread effect on my new Chatterbox update, so I am wondering if there is also a fix for the VIEW MESSAGE HISTORY?

I'd like to also reverse that thread.

Thanks!

Troy

FASherman
10-20-2004, 06:40 PM
What would really be killer would be integrating tombot and chatterbox!

Leif André
10-21-2004, 04:51 AM
Hi CocteauBoy. Just change the code on line 66 in the file viewhistory.php (in the folder plugins/p7_chatterbox/ of course ;)):

Change from: ORDER BY commentid DESC");
To: ORDER BY commentid ASC");

CocteauBoy
10-21-2004, 01:34 PM
YAY! Thanks, labrekke! It worked!