PDA

View Full Version : Code to delete a post


BirdOPrey5
05-23-2010, 06:41 PM
In an old thread I found a link to the vb 3.0.x mod:
https://vborg.vbsupport.ru/showthread.php?t=60704

which has the following code to 'quick soft delete' a thread with a 'remove' button:


<form action="editpost.php" method="post">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="p" value="$post[postid]" />
<input type="hidden" name="do" value="deletepost" />
<input type="submit" name="deletepost" value="<if condition="$deletebutton">delete<else />remove</if>" id="rb_del_soft" tabindex="1" class="button" />

</form>


The problem iwhen I try this on 3.8.x I get a message saying:
"Your submission could not be processed because a security token was missing."

I'm guessing the code to delete a message has changed- but I've searched through every thread with 'delete post' in the title and haven't found any means to do this for 3.8.x but it's obviously doable. Any ideas?

Thanks.

--------------- Added 1274643978 at 1274643978 ---------------

Nevermind, I found it... it was missing:
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />

--------------- Added 1274646564 at 1274646564 ---------------

OK, I still need help... apparently the code above is for a real/permanent delete, I need to change it to a 'soft' delete. I searched again but no luck.

--------------- Added 1274648406 at 1274648406 ---------------

OK.. so I guess this is a bigger issue then I thought it would be, maybe impossible... I see if a non-admin/super-mod uses the code above it does default to a soft delete which is fine... but I thought if displayed this code for any user, in this case for the thread starter only, I could allow any thread starter to delete any posts within their own thread... on an old forum I used to visit this was called 'troll control' - there currently is no mod or template edit to allow this for vb 3.7 or 3.8... the last vb version to have a working mod for this seems to be 3.0 but I *know* I've used this on a newer board... maybe 3.5? Anyway the point is even though i can get this code to display only for the thread owner pressing the button yields an error- I do not have permission to access this page because I don't have permission to delete a tread... I thought by giving them this code I was giving permission but apparently not. Does anyone know if there's a way around this? I want a thread owner to be able to delete (soft delete) any post in their own thread.

Thanks.