Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Send Email when topic deleted
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

motoclown
Starting Member

2 Posts

Posted - 17 April 2007 :  13:24:57  Show Profile  Reply with Quote
This is my first post, so be gentle!!

A little background first:
On one of the forums that I help administrate it appears that topics are being deleted for no particular reason. Users began to complain (and I don't blame them) that they would post a thread and it would be gone the next day. One of the administrators of the forum has a personal agenda with some of the users, so I wanted to find a way to send an email to myself every time a topic was deleted that contains some basic information about who was doing the deleting. I looked all over the support forums here and wasn't able to find anything that could really help me out, so I decided to write the code myself. This code could easily be re-used in other areas of the forum for different purposes. I've pasted the code below.

There are a couple of things I took into consideration when I wrote this. First off, this is just "quick and dirty" code. It does the job, it's not pretty and it's not meant to stay in there forever, I just needed something to work for a short time. Secondly, you'll want to consider how many topics are being deleted on your forums as you could easily get a ton of emails in a short time. We don't have that many deleted topics, so it's not a problem for me.

Now for the code:
The code should be pasted into the pop_delete.asp file. As always, make sure you make a backup of the original file before pasting this code in. On our setup, this code starts out on line 267 of the pop_delete.asp file, right after the line "set rs = nothing". Our forum is setup with an Access database and we're running Snitz version 3.4.03.


'#####Test code to send name of member who deleted topic to administrator#####
'#####Get user and topic information, then compose email and send it#####
set rs = Server.CreateObject("ADODB.Recordset")
strSql = "SELECT T.TOPIC_ID, T.T_SUBJECT, T.T_AUTHOR, M.M_NAME "
strSql = strSql & "FROM " & strActivePrefix & "TOPICS T, " & strMemberTablePrefix & "MEMBERS M "
strSql = strSql & "WHERE T.TOPIC_ID = " & cLng(delAr(i)) & " AND M.MEMBER_ID = T.T_AUTHOR"

rs.Open strSql, my_Conn

'##Get the subject and author of the topic being deleted
T_Subject = rs("T_SUBJECT")
T_Author = rs("M_NAME")

rs.close
set rs = nothing

'##Get member information for the member trying to delete the post##
set rs = Server.CreateObject("ADODB.Recordset")
strSql = "SELECT MEMBER_ID, M_LAST_IP "
strSql = strSql & "FROM " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & "WHERE M_NAME = '" & strDBNTFUserName & "'"

rs.Open strSql, my_Conn

Memb_IP = rs("M_LAST_IP")

rs.close
set rs = nothing

strBody = "The topic '" & T_Subject & "' created by " & T_Author & " has been deleted from the forums. "
strBody = strBody & "The member who deleted the topic is " & strDBNTFUserName & " with an IP address of "
strBody = strBody & Memb_IP & "."

Set myMail=CreateObject("CDO.Message")
myMail.Subject="Topic Deleted"
myMail.From="admin@yourdomain.com" 'change this
myMail.To="someone@somewhere.com" 'your email address
myMail.TextBody=strBody
myMail.Send
set myMail=nothing<

AnonJr
Moderator

United States
5768 Posts

Posted - 17 April 2007 :  14:39:28  Show Profile  Visit AnonJr's Homepage  Reply with Quote
Cool. Couple extra thoughts:

- You may want to reconsider your choice of Admin...

- And you may want to look at adding a function that logs a copy of the topic somewhere (just in case it needs to be resurrected because there was nothing wrong with it). It may be more trouble than its worth, and it is easier to demote the Admin. than to have to worry about this, but since you went through this much trouble why not go all the way?

Oh, and just as a courtesy, please put the code in the [scrollcode][/scrollcode] tags... keeps the post neat. <

Edited by - AnonJr on 17 April 2007 14:43:33
Go to Top of Page

pdrg
Support Moderator

United Kingdom
2897 Posts

Posted - 17 April 2007 :  15:57:28  Show Profile  Send pdrg a Yahoo! Message  Reply with Quote
Excellent stuff, and welcome by the way!

I second AnonJr in questioning your choice of admin/mod. I suggest something along the lines of a separate mod/admin-only section to your forum where mods can move threads and post gripes if they feel they need a user/thread castrating, as opposed to deleting. Here we hardly ever delete anything, although we may discuss a user/post in a separate area to agree a consensus on what's best to do with a topic/post - it works well :-)<
Go to Top of Page

motoclown
Starting Member

2 Posts

Posted - 17 April 2007 :  16:47:14  Show Profile  Reply with Quote
I'd love nothing more than to take away the admin rights of the person in question, however I just can't. Reason being is that this person is one of the owners of the site/forum and is generally unreasonable and hard to deal with. Even if I removed the rights, he'd just get someone else to give him his rights back (and get rid of me). So, I just wanted to create a bit of a log file so that if drastic action should be necessary I will have data to fall back on. I also like the idea of having an admin only section, but in this particular case it would be pointless. I can't even begin to express my frustrations about working with this individual - it would take me days of writing!!

AnonJR - Thanks for the tip about the scrollcode tags, I'll be sure to use them next time.<
Go to Top of Page

RArch
Junior Member

United Kingdom
103 Posts

Posted - 17 April 2007 :  17:22:13  Show Profile  Reply with Quote
Like here, I've got my admins/mods trained (more like drilled into) to never delete anything. If a post needs to be hidden we simply move the whole thread into a hidden forum where we can discuss it and decide what to do.

I've also added the split topic mod which makes it easier to pull out selected replies for hiding.

Personally I'd like to get rid of the delete topic/reply option altogether as the move option with the split topic mod is better since you keep the record. If a user cannot delete what they posted they may think twice before posting.
<
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000 Version 3.4.07