View Full Version : Quick Delete Post
This hack is an easy and cute one, of my 'Quick' series.
If you have permissions, it will allow you to delete a post with the simple click of a button, while you view the thread. If there is only one post in the thread, the hack will delete the entire thread, instead.
Also the hack is designed to prevent accidental post deletion. A warning message will popup to confirm the message deletion.
ESTIMATED INSTALL TIME: 4 minutes
REQUESTED BY: (nobody)
TESTED IN VERSION: 2.2.6
RELATED HACKS
Quick Reply Box (with Close/Open thread switch) (https://vborg.vbsupport.ru/showthread.php?s=&threadid=40380)
Quick Close/Open Thread (with reason) (https://vborg.vbsupport.ru/showthread.php?s=&threadid=40275)
HACK UPDATES
Version 1.1
------------------------------------
Changes:
- added deletion warning message
You like this hack? Please click (https://vborg.vbsupport.ru/misc.php?s=&action=install&threadid=40523) on the Install button.
To download the latest version of this hack, click below:
A screenshot...
Refresh the browser window to see the new look.
The hack can be also customized to have it as a link, instead of an image. Instructions are included in the hack file.
Velocd
07-01-2002, 06:31 PM
Nice, and very useful :)
zachb
07-01-2002, 06:59 PM
I love it!
*clicks install button*
Chris M
07-01-2002, 07:16 PM
Great!
Satan
MrLister
07-01-2002, 07:21 PM
Great, thank you!
Unknown553
07-01-2002, 07:58 PM
Uhhh, this hack already exists.... https://vborg.vbsupport.ru/showthread.php?s=&threadid=30933
Unknown553, did you look at the code? is not the same hack.
my hack will delete the post and also the thread. the hack you listed above will delete the post but will leave the thread active, wich will make it look like that (if you have only one post in it):
Version 1.1 released. A popup warning message was added to prevent accidental post deletion.
For those who installed the hack, simply replace the template with the new one.
Boofo
07-01-2002, 09:41 PM
How can I make it for Admins only or admin 1? And there's no way to get the confirm delete with a text link?
Originally posted by Nakkid
Unknown553, did you look at the code? is not the same hack.
my hack will delete the post and also the thread. the hack you listed above will delete the post but will leave the thread active, wich will make it look like that (if you have only one post in it):
question 1. in the hack file, replace:if (ismoderator($thread[forumid],"candeleteposts")) {with:if ($bbuserinfo['usergroupid']==6) {question 2. did you read the entire hack file?
Boofo
07-01-2002, 09:58 PM
Answer 1. Thank you. :)
Answer 2. Yes, I did, but is says to replace the stuff in the postbit delete template with the text link struff.
Originally posted by Nakkid
question 1. in the hack file, replace:if (ismoderator($thread[forumid],"candeleteposts")) {with:if ($bbuserinfo['usergroupid']==6) {question 2. did you read the entire hack file?
Boofo
07-01-2002, 10:04 PM
That's what I did and it does not warn me before I delete a post. :)
Originally posted by Nakkid
so do this. :)
you didnt read the hack file properly. let me quote from it:You can also use this as a link, instead of an image. Place the $post[delete] variable whereever you want in the postbit template and edit the 'postbit_deletepost' link to look, for example, like:
Boofo
07-01-2002, 10:29 PM
Yeah, I figured that out finally. Maybe you ought to have it be a little less confusing. Like saying that you need to replace the template contents with: and then just do the code again with the new link info in it. Or say something like change the link LINE in the above script to. I'm not a total idiot, so if I got confused, how many others will get confused also? And next time, instead of a "So do it", a little how to would have avoided repeated messages like this.
Originally posted by Nakkid
you didnt read the hack file properly. let me quote from it:
Boofo
07-01-2002, 10:37 PM
I get no warning at all on deletion. It just goes ahead and deletes the message. Here is the code I have in the postbit_deletepost template:
<script language="JavaScript">
function confirmdelete() {
messagebox=confirm('You have chosen to delete Post $post[postid].\r\rClick OK to delete it, or Cancel to hide this prompt.');
if (messagebox==true) { window.location='editpost.php?s=$session[sessionhash]&action=deletethispost&postid=$post[postid]'; }
else { }
}
</script>
<smallfont><a href="editpost.php?s=$session[sessionhash]&action=deletethispost&postid=$post[postid]">Delete Post</a></smallfont>
Unknown553
07-01-2002, 10:40 PM
Originally posted by Nakkid
Unknown553, did you look at the code? is not the same hack.
my hack will delete the post and also the thread. the hack you listed above will delete the post but will leave the thread active, wich will make it look like that (if you have only one post in it):
Ahh ok. Just making sure :)
boofo, the link should look like that:<a href="javascript:confirmdelete()">Delete Message</a>
remove the space between java and script
also, related to:
Originally posted by Boofo
Yeah, I figured that out finally. Maybe you ought to have it be a little less confusing. Like saying that you need to replace the template contents with: and then just do the code again with the new link info in it. Or say something like change the link LINE in the above script to. I'm not a total idiot, so if I got confused, how many others will get confused also? And next time, instead of a "So do it", a little how to would have avoided repeated messages like this.there is no need for me to do this. first you will learn from it, while you hack the files and second, as you stated yourself, is clearly marked, nothing confusing. it says 'replace the link'. sorry if you felt offended but my intention was to make you understand that is important to read well the hack file before you post.
i would like to know if other collegues, from vB.org, find it confusing. i always try to make my hack files as clear as possible.
post here and let me know please if the information included is clear. thanks.
Sinecure
07-02-2002, 12:01 AM
This hack installed perfectly, just as I wanted. The instructions were as clear as day, I'm not exactly sure where you went wrong Bofo, his instructions seemed more then clear to me?
Regardless, great hack Nakkid :)
Boofo
07-02-2002, 12:12 AM
This is not the code you said to put in the text link in the file I downloaded. There was no java script in the text link itself at all. That's where I got confused. Now it makes more sense when you show it to me. :)
Originally posted by Nakkid
boofo, the link should look like that:<a href="javascript:confirmdelete()">Delete Message</a>
grrrr.. firefly's hacks snooping arround... :)
remove the space between java and script
np boofo. :)
is all clear now? let me know if there is something else you are not sure and i will tell you how to do it.
all the best,
floren.
Boofo
07-02-2002, 12:19 AM
Nakkid,
Here is the code you had in the original file that you said I need to put in if it was a text link.
<smallfont><a href="editpost.php?s=$session[sessionhash]&action=deletethispost&postid=$post[postid]">Delete Post</a></smallfont>
That doesn't look any where near what you have in it now for this replacement. You changed it.
<a href="java script:confirmdelete()">Delete Message</a>
That is what was confusing me. Your instructions were wrong.
So, I guess I DID read ther instructions right the first time, huh?
This hack installed perfectly, just as I wanted. The instructions were as clear as day, I'm not exactly sure where you went wrong Bofo, his instructions seemed more then clear to me?
Sinecure,
You must have gotten the updated file then. :)
i understand now where was the prob. everytime you download again a file at vB.org, you must clear before the chache, orelse it will download the same old file.
Boofo
07-02-2002, 12:32 AM
The file I downloaded the first time was also called 1.1. You had added the javascript code but not changed the text link in it yet. The new file with the text link changed is the same version number. My cache was cleared the first time for the file becasue I had not downloaded it before. So, I don't need anything else explained. All I needed was the right file in the first place, which is there now. You changed that text link after my message that it didn't work, huh? :)
Originally posted by Nakkid
i understand now where was the prob. everytime you download again a file at vB.org, you must clear before the chache, orelse it will download the same old file.
nope. i did not change it. why would i do this?
boofo, i always check my hacks properly and test them before i release them. also i always read the info properly just to make sure people get it right.
rest assured that if i would do this, forget to update a little piece of info, i will mention it here. so people know.
i use the auto-change function in my editor.. so it changes automatically everything in the command i enter. so when i highlighted the link, it replace it twice. and i never used in both files <smallfont>.
i send you a pm telling you to delete the irelevant posts you made here, to cleanup the thread. is up to you if you want to do this. acusing people that they do stuff like the one you posted above, wont get you far... at least not with me. thanks for the "cool" post.
let me know if you have any other problems with the hack.
regards,
floren.
Admin
07-02-2002, 07:43 AM
Originally posted by Nakkid
grrrr.. firefly's hacks snooping arround... :)
What?! Please delete that post, you are implying I created a hack that caused this confusiong when it's really vBulletin that separates java and script..
Sinecure
07-02-2002, 07:49 AM
Ummm, regardless, great hack nakkid.
I think I'm going to apply the modification so that only I can see this, or only administrators for that matter. I just don't want mods accidently deleting threads.
Boofo
07-02-2002, 10:59 AM
Nakkid,
The smallfont part was the part I added to your original code when I put it in the postbit _deletepost. You didn't have the smallfont tags in your original code. When I quoted it, I quoted it from the template file since I already had it open replacing the code with the NEW code in your UPDATED hack file. When I get to the day I find myself not being able to read and understand a hack so small and simple, then I'll hang up the old board and call it quits. I've installed too many hacks by now to make that kind of mistake every time. Give me a little more credit than that.
It really doesn't matter anyway, Floren. I installed that hack, got the right code for it now and it works great. What bothers me is your defence stance over something that a hundred other hack writers have done a thousand times before and never had a problem dealing with. I'm glad to see that we have at least one perfect hack writer here. I was starting to get worried. ;)
Boofo
07-02-2002, 11:42 AM
I noticed a small problem when you are deleting posts. If you go to delete a post and canel out of it, the next post in the same thread you go to delete will have the very same thread id number. Any post you click on in that same thread and cancel out of will always have the same thread id. Is it supposed to work that way? :)
Originally posted by FireFly
What?! Please delete that post, you are implying I created a hack that caused this confusiong when it's really vBulletin that separates java and script.. done. had no idea it was done by vB.
also... i listen to your suggestions chen related to the accidental deletion of the message. great idea you had on the previous thread and that's why i released v1.1 where i added the warning popup. let me know if you like the way i wrote the hack. i think my version is better then the other one (wich i didnt even know it existed, thanks Unknown553). read more here on my comments about this:
https://vborg.vbsupport.ru/showthread.php?postid=268065#post268065
your comments made in the another hack version:
https://vborg.vbsupport.ru/showthread.php?postid=189916#post189916
Chris M
07-02-2002, 07:00 PM
Nakkid...
The instructions were perfectly clear:)
Satan
Mini Fix.
Replace
<script language="JavaScript">
function confirmdelete() {
messagebox=confirm('You have chosen to delete Post $post[postid].\r\rClick OK to delete it, or Cancel to hide this prompt.');
if (messagebox==true) { window.location='editpost.php?s=$session[sessionhash]&action=deletethispost&postid='$post[postid]; }
else { }
}
</script>
with
<script language="JavaScript">
var postid;
function confirmdelete(postid) {
messagebox=confirm('You have chosen to delete Post ' + postid + '.\r\rClick OK to delete it, or Cancel to hide this prompt.');
if (messagebox==true) { window.location='editpost.php?s=$session[sessionhash]&action=deletethispost&postid=' + postid; }
else { }
}
</script>
and then replace
<a href="javascript:confirmdelete()">Delete Message</a>
with
<a href="javascript:confirmdelete('$post[postid]')">Delete Message</a>
The popup should work fine now if any of you had problem with it.
great job neo...
i added your fix to the file. except the variable define. you dont need it. thanks. :)
replace your old template with this one:<script language="JavaScript">
function confirmdelete(postid) {
messagebox=confirm('You have chosen to delete Post '+postid+'.\r\rClick OK to delete it, or Cancel to hide this prompt.');
if (messagebox==true) { window.location='editpost.php?s=$session[sessionhash]&action=deletethispost&postid='+postid; }
else { }
}
</script>
<a href="javascript:confirmdelete($post[postid])"><img src="{ imagesfolder}/delete.gif" border="0" alt="Delete Message"></a>dont forget to remove the space in front of 'imagesfolder}' and also the one between 'java' and 'script'.
ixian
07-03-2002, 06:39 AM
Just checking before I install - don't want to sound retarded here, but the button/link does NOT show up for users who don't have permissions, correct? I only want my admins and mods to see this. Yes, my mods - I have a decent crew and I really want them to have this feature. I have a real problem on my forums with thread derailment - somebody will ask a question, next thing you know 4 or 5 post later it's totally off topic or people are flaming each other. I'm also going to install the post *nuked* hack, but this one will be useful as well.
Boofo
07-03-2002, 06:49 AM
Thanks, Neo! That fixed the message id problem. Works great! :)
Originally posted by ixian
Just checking before I install - don't want to sound retarded here, but the button/link does NOT show up for users who don't have permissions, correct? I only want my admins and mods to see this. Yes, my mods - I have a decent crew and I really want them to have this feature. I have a real problem on my forums with thread derailment - somebody will ask a question, next thing you know 4 or 5 post later it's totally off topic or people are flaming each other. I'm also going to install the post *nuked* hack, but this one will be useful as well. the button will show only to people who have perms to delete posts.
globalwin
07-07-2002, 12:27 PM
Everything went well install, but I have a few other things install also, when I click the delete post and confirm it, it takes me to the edit post :(
SpeedStreet
08-14-2002, 01:47 AM
Nakkid,
Great job on this hack...Just one quick question before I install it....Will this give users the ability to quick delete their own posts? I would like to have the ability for users to delete their own from the threadview, and your hack seems to be the closest thing to it...I just wanted to clarify before I got to installing this tommorrow morning.
Thanks for this and your other great hacks, I plan on using a bunch of them in my upcoming site!
- John
this hack will show only to users who have perms to delete posts.. not to the users himselfs... the user who posted, will have to go to edit/delete button, click on it and delete his(her) post. this hack was designed to ease the admin/mod's work. :)
SpeedStreet
08-14-2002, 01:03 PM
thanks for the quick response!
I tried it out, it works great for the intended purpose.
PhoenixBB
08-26-2002, 03:54 PM
Hi, nice hack :)
No trouble with the installation and popup worked fine when I tested it, but I seem to have a very weird problem that nobody else has mentioned.
The icon only appears every other post. Sometimes it'll appear on two posts in a row then not for the next 3 and then appear on the next but not the following. Anyone know why?
what vb version you have? even if this hack was tested on 226 only, it should work fine in any version starting from 221.
check your code again... and remember that the hack was tested on a unhacked board.
Has anyone got the default purple delete button? thanks ;)
hidjra
09-12-2002, 09:39 AM
this hack added a querie for each post in the thread, anyone else with this problem, nobody else metioned it.
hidjra
just check you code. the hack doesnt add any query.
you edited wrong the code. remember the mistakes you had on forumhome? double check your steps always...
ZiRu$
09-14-2002, 01:19 AM
nice i will install now
JohnWoo
09-22-2002, 09:53 AM
if post by unregistered pplz i can`t delete it ! Why ?
BladesM3
09-29-2002, 05:26 PM
some people i cant delete their posts.. why...
Gnu5124
10-02-2002, 05:03 PM
Great Hack!
On vB 2.2.6 I got problems with it cause the "Delete" Button not appeared at every post.
Now on vB 2.2.8 I installed it, checked every step twice and it works great...
JohnWoo
10-23-2002, 08:45 PM
TECH - can you help me ?
>>if post by unregistered pplz i can`t delete it ! Why ?
TheSaint-AeD
10-24-2002, 08:33 AM
Originally posted by Tha Rock
Has anyone got the default purple delete button? thanks ;)
Here you are :)
TheSaint-AeD
10-24-2002, 09:07 AM
Teck, there may be some Bug in your Hack causing a Query-Loop, please visit the following Thread: https://vborg.vbsupport.ru/showthread.php?s=&threadid=44845&perpage=15&display=&pagenumber=2
TheSaint-AeD
10-24-2002, 09:47 AM
There is a proof this Hack has a Query-Loop adding +1 Querries / Post for Moderators and +2 Querries / Post for non-Moderators. Do not install this Hack until we Post a fixed Code here!
functions.php (code section related to my hack, check the file)
FIND:
if (ismoderator($thread[forumid],"candeleteposts")) {
REPLACE WITH:
if (in_array($bbuserinfo['usergroupid'], array(5, 6))) {
this change will make not to load any query at all. i updated the file.
JohnWoo
10-24-2002, 12:48 PM
TECH - can you help me? Read above
the hack deletes any posts. i have no idea why it doesnt for you.
X-Fan
11-03-2002, 12:57 PM
Thanks for the fix, TECK!
cessna140
12-06-2002, 03:12 AM
I too cannot delete posts by unregistered users. The delete link does not appear. Any ideas?
Odysseus
12-08-2002, 08:03 AM
One suggestion:
Is it somehow possible to return to the current page?
When a moderator deltes a post, the forum will bring him back to page 1 of the thread. It would be extremly useful if he would be redirected to the page where he was before deleting the post. :)
How can this be done?
TECK the same problem with unregistered users!!! :ermm:
HiSquad
12-30-2002, 09:41 AM
Thank you
alkatraz
01-05-2003, 05:51 PM
Works great! Thank you kindly!!
The only small issue I had when installing was the "$templatesused =" part. There are 2 references to this inside showthread.php. I used the first one of course but you might want to add that in the instructions.
Thanks!!!!!!!
Dribbles
01-06-2003, 01:49 AM
thnx, installed
Yuber
02-20-2003, 03:20 PM
Thanks for the hack
BrAinZ
03-02-2003, 09:56 PM
Originally posted by TheSaint-AeD
Here you are :) Don't suppose that anyone has a nice ORANGE delete button kicking around ... PLEASE ??
ImportPassion
03-17-2003, 01:38 PM
this isn't deleting my posts. it deletes the pagetext tho, but that is no good.
Could it be realted to the store hack?
leitel
04-19-2003, 03:59 AM
don't know why, but the button (or text if used) appears. It's late so i'll take a crack at it again tomorrow.
sorry, but tell me, did u solve problem wuth guests posts? I need to delete them as well! :(
futuredood
08-08-2003, 05:07 PM
anyway to make this hack, so moderators can use also?
the admins can only use it
I want to let the moderators use it also.
floridaideal
08-21-2003, 08:35 AM
Hi, I can't delete unregistered guests either, I am using newsgroup hack so I want to delete a load of crap posts, please anyone know how to sort this?
Thanks
Stu
y2krazy
12-23-2003, 10:38 PM
if (in_array($bbuserinfo['usergroupid'], array(5, 6))) {
Installed the hack on 2.3.0, but had a little problem with the line above. You should remove the space between the "5," and the "6" so that it will work correctly. That was the only problem I had. Should read as the following:
if (in_array($bbuserinfo['usergroupid'], array(5,6))) {
Thanks for a great new feature, TECK! :D
[EDIT: When trying to edit a post, I got an SQL error, so I removed the edit to the editpost.php file, and everything works smoothly now. Not sure what was being done on editpost.php, but the code obviously isn't required to delete posts... :rolleyes:]
-y2k-
y2krazy
01-13-2004, 01:06 AM
Also, when I click on the "Delete Post" link(changed it from an image to a text link), I get the prompt, but then I am taken to a blank page. I go back to the thread, refresh, and the post/thread is still there. Any help is appreciated!
http://forums.bladestorm.net/showthread.php?s=&postid=7587#post7587 (you can probably only see it if you're logged in and are a Mod or higher though...)
-y2k-
y2krazy
01-15-2004, 03:06 AM
Anyone else have this problem and resolve it?
-y2k-
y2krazy
02-01-2004, 07:58 PM
Still looking for any help...
When I click on the "Delete Post" link(changed it from an image to a text link), I get the prompt, but then I am taken to a blank page. I go back to the thread, refresh, and the post/thread is still there. Any help is appreciated!
-y2k-
Dataforce
02-26-2004, 04:03 PM
any chance of a VB3 version TECK ?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.