PDA

View Full Version : Rename Thread on Reply


Tommy Boy
02-05-2002, 10:00 PM
If you run a support forum, you certainly hate these thread with names like "BUG!" or "NOT WORKING!" or "HELP!!", because they don't give any indication about the content of the threads, and other users will probably create new threads with similar content, just because the other thread names were not clear enough.

After installing this hack, you will be able to change a thread title when replying to it, without having to go to the admin panel, and waste precious time and clicks.

afterlab
02-05-2002, 10:08 PM
Nice job! I love the option for saving time. I'll add it onto my Forums sometime tomorrow morning. Thanks again.

Dade
02-06-2002, 02:24 AM
Awesome :)

Tommy Boy
02-06-2002, 08:44 AM
For those who already downloaded it, I forgot the most important part:


Open template: New Posting Templates -> newreply, look for:
--------------------------------------------------------------------------------
$logincode
--------------------------------------------------------------------------------

After it, add:
--------------------------------------------------------------------------------
$renamethread
--------------------------------------------------------------------------------


Sorry for that... :D

mas404
02-06-2002, 09:43 AM
thank you for this hack realy it is cool

thanx

squawell
02-06-2002, 11:04 AM
nice hack u did~~~:D:D

another question~??

can rename title but only edit the first post not reply to rename

the title??can do that??

Tommy Boy
02-07-2002, 06:48 AM
Originally posted by squawell
nice hack u did~~~:D:D

another question~??

can rename title but only edit the first post not reply to rename

the title??can do that??
Sure, everything is possible. But it's another hack.

Logician
12-04-2002, 11:48 AM
nice and very useful hack.. Working great in 2.2.9.. Too bad it's forgotten in the depths of Full Releases section. Maybe my bumping will help.. :glasses:

Dean C
12-04-2002, 04:08 PM
Haha what a wonderful idea :)

- miSt

Kars10
12-04-2002, 05:24 PM
installed! :)

Dean C
12-06-2002, 03:50 PM
This should be default on vb3

And i'd love this installed here..

Useful when posting updates to hacks :D

- miSt

Chris M
12-06-2002, 05:29 PM
Nice:)

Satan

Boofo
05-10-2003, 09:40 PM
Is there a way to update the lastthread when you update the thread title? I tried doing it underneath this hack and it never updates the lastthread for me. I am using PPN's (Scott's) vb last title hack and would like to update the last thread on the forumdisplay and forumhome.

Austin Dea
05-10-2003, 10:31 PM
That should be easy enough, let me look into it.

Boofo
05-10-2003, 10:38 PM
Good luck. I've been messing with it for about 3 hours now and nothing I have tried works. ;)

Austin Dea
05-10-2003, 11:05 PM
Boofo, find this in newreply.php (it's the change to newreply in PPN's hack): if ($visible==1) {
$DB_site->query("UPDATE forum SET replycount=replycount+1,lastpost='".time()."',lastposter='".addslashes($postusername)."',lasttitle='".addslashes(htmlspecialchars($threadinfo[title]))."' WHERE forumid IN ($foruminfo[parentlist])");
}
Change $threadinfo[title] to $newthreadtitle ;)

I've tested it and it appears to work fine =)

Boofo
05-10-2003, 11:13 PM
What if you don't change the title, though, but you change something else?

Austin Dea
05-10-2003, 11:24 PM
The code you add for this hack deals with that. If you don't change, it stays the same.

Boofo
05-10-2003, 11:30 PM
Ok, here is what I have now:

// update forum stuff
if ($newthreadtitle) {
$newtitle="'".addslashes(htmlspecialchars($newthreadtitle))."'";
} else {
$newtitle="'".addslashes(htmlspecialchars($threadinfo[title]))."'";
}
if ($visible==1) {
$DB_site->query("UPDATE forum SET replycount=replycount+1,lastpost='".time()."',lastthread=$newtitle,lastposter='".addslashes($postusername)."' WHERE forumid IN ($foruminfo[parentlist])");
}

This way, it only updates it as the newthreadtitle if there is one. Otherwise, it leaves it alone. Wouldn't this way be better? Or not? I'm really not sure. (But it works! ;))

Thank you sir, I never thought of messing with that area. ;)

Austin Dea
05-10-2003, 11:31 PM
The first part of the third edit in this hack does that already, but that works ;)

Boofo
05-10-2003, 11:44 PM
Ok, I changed it to use your code. It does work. But if you take out the thread title in a new post and leave the line blank, the forum info gets updated with a blank last thread title. How do we fix that? ;)

Austin Dea
05-10-2003, 11:45 PM
1) Why would anyone do that?
2) I think PPN's does that too..

Maybe a fix for both could be done..

Boofo
05-10-2003, 11:48 PM
Does that mean you will find a way?

And you and I both know there are users out there (Mods) who will do it just to be doing it. ;)

Austin Dea
05-11-2003, 12:01 AM
Here's the only way I can think of. Change: if ($visible==1) {
$DB_site->query("UPDATE forum SET replycount=replycount+1,lastpost='".time()."',lastposter='".addslashes($postusername)."',lasttitle='".addslashes(htmlspecialchars($newthreadtitle))."' WHERE forumid IN ($foruminfo[parentlist])");
}
to: if ($visible==1) {
if ($newthreadtitle=="") {
$DB_site->query("UPDATE forum SET replycount=replycount+1,lastpost='".time()."',lastposter='".addslashes($postusername)."',lasttitle='".addslashes(htmlspecialchars($threadinfo[title]))."' WHERE forumid IN ($foruminfo[parentlist])");
} else {
$DB_site->query("UPDATE forum SET replycount=replycount+1,lastpost='".time()."',lastposter='".addslashes($postusername)."',lasttitle='".addslashes(htmlspecialchars($newthreadtitle))."' WHERE forumid IN ($foruminfo[parentlist])");
}
}

Appears to work fine.

Boofo
05-11-2003, 12:11 AM
Wouldn't the code I had before I changed it to yours work the same way? ;)

Austin Dea
05-11-2003, 12:14 AM
Now that I look at it, yep =D

Boofo
05-11-2003, 12:29 AM
All is working right, now. ;)

Thank you again for showing me the way. ;)

You any good with queries? ;)

Austin Dea
05-11-2003, 12:32 AM
Maybe.. PM me.

Austin Dea
05-11-2003, 12:47 AM
Your PM box is full, Boofo.

Boofo
05-11-2003, 03:59 AM
Sorry about that. I just got home and had about 5 messages from vb.org's auto_message_full_box_reporter. ;) It is taken care of. I didn't think I was that close. ;)

Paul
06-04-2003, 02:55 AM
There's a nasty little bug in this hack. Essentially, the title will always be overwritten when replied to by a moderator but it will not strip special html characters. If you've installed this hack, follow the following steps to fix it. In newreply.php, find:


$DB_site->query("UPDATE thread SET title='" . addslashes ($newthreadtitle) . "' WHERE threadid='$threadid'");


Replace it with:

$DB_site->query("UPDATE thread SET title='".addslashes(htmlspecialchars($newthreadtitle))."' WHERE threadid='$threadid'");

Find and REMOVE the following line:

$newthreadtitle = htmlspecialchars ($newthreadtitle);

You will now need to run a series of MySQL queries to fix threads affected by this bug:


UPDATE `thread` SET title = REPLACE(title,"\"","&quot\;") WHERE title LIKE "%\"%";
UPDATE `thread` SET title = REPLACE(title,">","&gt\;") WHERE title LIKE "%>%";
UPDATE `thread` SET title = REPLACE(title,"<","&amp;lt\;") WHERE title LIKE "%<%";
UPDATE `thread` SET title = REPLACE(title,"&","&amp;amp\;") WHERE title NOT REGEXP "&(quot|amp|lt|gt)" AND title LIKE "%&%";


As usual, backup everything before doing the above.

Best wishes,
Paul

Edit: Due to a bug on vbulletin.org, I had to alter the queries and add an additional &amp; to get them to display properly. They should appear correctly now.

Boofo
06-04-2003, 06:15 AM
I don't mean to sound stupid here, but what does this fix actually do? I can add quotes to the thread title with no problems.

Paul
06-04-2003, 10:40 AM
It removes special html characters from a string and fixes a bug that was causing your hack to always update the database when a moderator replied. See:

www.php.net/htmlspecialchars

Certain functions on the forum require that the text stored in the database be htmlspecialchars()'ed. For an example, create a new thread with a title that has quotation marks in it, reply to that thread with a moderator account, and then attempt to split the thread. Notice what happens to the thread title.

All input should be processed with htmlspecialchars(); :) The first change in my post above corrrects that. The second change fixes the matching check. The queries add special html tags (like &quot; instead of ") to existing thread titles that may have already been affected by this hack.

After a year of running with this hack, we had approximately 400 out of ~60,000 threads which had the problem. We only realized it when someone tried to split one.

WEForums
06-04-2003, 01:22 PM
Today at 12:40 PM LoveShack said this in Post #33 (https://vborg.vbsupport.ru/showthread.php?postid=404285#post404285)
For an example, create a new thread with a title that has quotation marks in it, reply to that thread with a moderator account, and then attempt to split the thread. Notice what happens to the thread title. Umm... I did that...notice the ;quot thing...however, I plit the thread and everything was normal. I don't understand what is 'wrong' or 'different.' :ermm: