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

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Classic ASP versions(v3.4.XX)
 Pending members - "Deleted ones"
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

philsbbs
Junior Member

United Kingdom
397 Posts

Posted - 27 June 2007 :  19:24:49  Show Profile
Hi,

I want to copy the members from members_pending to members_pending_deleted before they get deleted.

So I have a backup in case I need it.

I've found the delete code.
==
elseif strAction = "delete" then
if selID = "-1" then
'## Forum_SQL - Delete the Member
strSql = "DELETE FROM " & strMemberTablePrefix & "MEMBERS_PENDING "
strSql = strSql & " WHERE M_STATUS = " & 0
strSql = strSql & " AND M_LEVEL = " & -1

my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords

Response.Write " <br /><p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """><b>Members Deleted!</b></font></p>" & vbNewLine & _
" <meta http-equiv=""Refresh"" content=""2; URL=admin_accounts_pending.asp"">" & vbNewLine & _
" <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """>All pending members have been deleted!</font></p>" & vbNewLine & _
" <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""admin_accounts_pending.asp"">Back To Members Pending</font></a></p>" & vbNewLine
WriteFooter
Response.End
==

What is the sql code to copy it before it's deleted.

Thanks in advance.

Phil

Jezmeister
Senior Member

United Kingdom
1141 Posts

Posted - 27 June 2007 :  19:34:01  Show Profile  Visit Jezmeister's Homepage
you should be able to just c & p the insert code to the members table for when you approve members and change the table name, you'll have to add a new action for when you permanently delete a member and use the code that's currently there for that.
Go to Top of Page

gary b
Junior Member

USA
267 Posts

Posted - 28 June 2007 :  08:46:03  Show Profile  Visit gary b's Homepage
quote:
I want to copy the members from members_pending to members_pending_deleted before they get deleted.

So I have a backup in case I need it.



Of course, that implies that you have provisions to retrieve the data... 'in case you need it'. Without a method to retrieve the data, I question the usefulness of the change. [Unless you access the database directly via Access]

Working for government, I learned that we RARELY *delete* data. There is some merit to this position. Although it would require changing the forum code, you may want to consider this idea.

1. Add a 'deleted' Y/N field to the members_pending table (acts as a 'flag')
2. Revise Admin member processing page (admin_members_pending?) to enter 'True' for [deleted] field and NOT actually delete data
3. Revise Admin member processing page to include 'where' clause to display pending members. [WHERE FORUM_MEMBERS_PENDING.deleted = False]

Hopefully this conveys my approach. You would still have to make provisions to 'clean up' this table from time to time. Since I copy the forum database to local HDD (for backup) periodically, I would clean up the table directly in Access. Copy database back to server and you are current with forum and backup.

Your mileage may vary...

Edit: Fix typo

Edited by - gary b on 28 June 2007 08:47:20
Go to Top of Page

philsbbs
Junior Member

United Kingdom
397 Posts

Posted - 28 June 2007 :  14:50:48  Show Profile
I was thinking more off :-

insert into pending_members_deleted
select *

etc

Any others ideas, code examples.

Phil
Go to Top of Page

gary b
Junior Member

USA
267 Posts

Posted - 28 June 2007 :  17:45:49  Show Profile  Visit gary b's Homepage
Allow me to add one point to my approach...

By employing a 'flag', you can (as Admin M_LEVEL=3) modify the page so YOU can see both 'deleted' and current pending members. [Or create a clone of admin_members_pending that will do this.] The beauty of this is that -- if you want to UNdelete a record -- simply uncheck the flag (set = False).

I use this approach often in my databases. I believe code changes would be minimal using this method.

FWIW...
Go to Top of Page

philsbbs
Junior Member

United Kingdom
397 Posts

Posted - 28 June 2007 :  18:00:25  Show Profile
I fully understand and agree with you but at this stage my change is more for monitor purposes, bit of a long story.

Could you help with the sql for my needs.

Phil
Go to Top of Page

gary b
Junior Member

USA
267 Posts

Posted - 28 June 2007 :  22:04:46  Show Profile  Visit gary b's Homepage
philsbbs...

What is your timetable? Due in two weeks? Crisis -- need it now???

Like everyone else, 'time' is in short supply. But given a week, I might well have something for you...
quote:
I want to copy the members from members_pending to members_pending_deleted before they get deleted.

That's all, correct??


Go to Top of Page

philsbbs
Junior Member

United Kingdom
397 Posts

Posted - 29 June 2007 :  02:24:00  Show Profile
I can wait two weeks.

Thanks in advance for your help.

Phil
Go to Top of Page

philsbbs
Junior Member

United Kingdom
397 Posts

Posted - 30 June 2007 :  05:58:10  Show Profile
Solution found, thanks to Rui.

Trigger added to sql server.
=
CREATE TRIGGER del_trigger ON FORUM_MEMBERS_PENDING
FOR DELETE
AS

INSERT INTO FORUM_MEMBERS_PENDING_DELETED
SELECT * FROM DELETED
=

Please note in order for this to work for me I had to change some fields from ntext to nvarchar(4000).

So my solution might not be suitable for you.

Thanks Rui for all your help.

Your a true asset to Snitz.

Phil
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 30 June 2007 :  07:02:44  Show Profile  Send ruirib a Yahoo! Message
You're welcome Phil.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

gary b
Junior Member

USA
267 Posts

Posted - 01 July 2007 :  13:38:30  Show Profile  Visit gary b's Homepage
Geesh!! That seems too simple. Hadn't check this thread until I had already made code changes. So -- for whatever it's worth -- here are changes necessary to admin_accounts_pending page:

In an UNmodified file, replace lines 187 to and including 219 with following code:


elseif strAction = "delete" then
if selID = "-1" then
'## Forum_SQL - Add the Members to Member_Deleted table
strSqldel = "INSERT INTO FORUM_MEMBERS_DELETED ( MEMBER_ID, M_STATUS, M_NAME, M_USERNAME, M_PASSWORD, M_EMAIL, M_COUNTRY, "
strSqldel = strSqldel & "M_HOMEPAGE, M_SIG, M_VIEW_SIG, M_SIG_DEFAULT, M_DEFAULT_VIEW, M_LEVEL, M_AIM, M_ICQ, M_MSN, M_YAHOO, M_POSTS, "
strSqldel = strSqldel & "M_DATE, M_LASTHEREDATE, M_LASTPOSTDATE, M_TITLE, M_SUBSCRIPTION, M_HIDE_EMAIL, M_RECEIVE_EMAIL, M_LAST_IP, M_IP, "
strSqldel = strSqldel & "M_FIRSTNAME, M_LASTNAME, M_OCCUPATION, M_SEX, M_AGE, M_DOB, M_HOBBIES, M_LNEWS, M_QUOTE, M_BIO, M_MARSTATUS, "
strSqldel = strSqldel & "M_LINK1, M_LINK2, M_CITY, M_STATE, M_PHOTO_URL, M_KEY, M_NEWEMAIL, M_PWKEY, M_APPROVE, M_SHA256 ) "
strSqldel = strSqldel & "SELECT FORUM_MEMBERS_PENDING.MEMBER_ID, FORUM_MEMBERS_PENDING.M_STATUS, FORUM_MEMBERS_PENDING.M_NAME, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_USERNAME, FORUM_MEMBERS_PENDING.M_PASSWORD, FORUM_MEMBERS_PENDING.M_EMAIL, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_COUNTRY, FORUM_MEMBERS_PENDING.M_HOMEPAGE, FORUM_MEMBERS_PENDING.M_SIG, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_VIEW_SIG, FORUM_MEMBERS_PENDING.M_SIG_DEFAULT, FORUM_MEMBERS_PENDING.M_DEFAULT_VIEW, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_LEVEL, FORUM_MEMBERS_PENDING.M_AIM, FORUM_MEMBERS_PENDING.M_ICQ, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_MSN, FORUM_MEMBERS_PENDING.M_YAHOO, FORUM_MEMBERS_PENDING.M_POSTS, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_DATE, FORUM_MEMBERS_PENDING.M_LASTHEREDATE, FORUM_MEMBERS_PENDING.M_LASTPOSTDATE, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_TITLE, FORUM_MEMBERS_PENDING.M_SUBSCRIPTION, FORUM_MEMBERS_PENDING.M_HIDE_EMAIL, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_RECEIVE_EMAIL, FORUM_MEMBERS_PENDING.M_LAST_IP, FORUM_MEMBERS_PENDING.M_IP, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_FIRSTNAME, FORUM_MEMBERS_PENDING.M_LASTNAME, FORUM_MEMBERS_PENDING.M_OCCUPATION, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_SEX, FORUM_MEMBERS_PENDING.M_AGE, FORUM_MEMBERS_PENDING.M_DOB, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_HOBBIES, FORUM_MEMBERS_PENDING.M_LNEWS, FORUM_MEMBERS_PENDING.M_QUOTE, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_BIO, FORUM_MEMBERS_PENDING.M_MARSTATUS, FORUM_MEMBERS_PENDING.M_LINK1, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_LINK2, FORUM_MEMBERS_PENDING.M_CITY, FORUM_MEMBERS_PENDING.M_STATE, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_PHOTO_URL, FORUM_MEMBERS_PENDING.M_KEY, FORUM_MEMBERS_PENDING.M_NEWEMAIL, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_PWKEY, FORUM_MEMBERS_PENDING.M_APPROVE, FORUM_MEMBERS_PENDING.M_SHA256 "
strSqldel = strSqldel & "FROM FORUM_MEMBERS_PENDING "
strSqldel = strSqldel & " WHERE M_STATUS = " & 0
strSqldel = strSqldel & " AND M_LEVEL = " & -1

my_Conn.Execute (strSqldel),,adCmdText + adExecuteNoRecords

'## Forum_SQL - Delete the Member
strSql = "DELETE FROM " & strMemberTablePrefix & "MEMBERS_PENDING "
strSql = strSql & " WHERE M_STATUS = " & 0
strSql = strSql & " AND M_LEVEL = " & -1

my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords

Response.Write " <br /><p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """><b>Members Deleted!</b></font></p>" & vbNewLine & _
" <meta http-equiv=""Refresh"" content=""2; URL=admin_accounts_pending.asp" & strPage & """>" & vbNewLine & _
" <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """>All pending members have been deleted!</font></p>" & vbNewLine & _
" <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""admin_accounts_pending.asp" & strPage & """>Back To Members Pending</font></a></p><br />" & vbNewLine

WriteFooter
Response.End

else
aryID = split(selID, ",")
aryIDdel = split(selID, ",")
for i = 0 to ubound(aryIDdel)
'## Forum_SQL - Add the Member to Member_Deleted table
strSqldel = "INSERT INTO FORUM_MEMBERS_DELETED ( MEMBER_ID, M_STATUS, M_NAME, M_USERNAME, M_PASSWORD, M_EMAIL, M_COUNTRY, "
strSqldel = strSqldel & "M_HOMEPAGE, M_SIG, M_VIEW_SIG, M_SIG_DEFAULT, M_DEFAULT_VIEW, M_LEVEL, M_AIM, M_ICQ, M_MSN, M_YAHOO, M_POSTS, "
strSqldel = strSqldel & "M_DATE, M_LASTHEREDATE, M_LASTPOSTDATE, M_TITLE, M_SUBSCRIPTION, M_HIDE_EMAIL, M_RECEIVE_EMAIL, M_LAST_IP, M_IP, "
strSqldel = strSqldel & "M_FIRSTNAME, M_LASTNAME, M_OCCUPATION, M_SEX, M_AGE, M_DOB, M_HOBBIES, M_LNEWS, M_QUOTE, M_BIO, M_MARSTATUS, "
strSqldel = strSqldel & "M_LINK1, M_LINK2, M_CITY, M_STATE, M_PHOTO_URL, M_KEY, M_NEWEMAIL, M_PWKEY, M_APPROVE, M_SHA256 ) "
strSqldel = strSqldel & "SELECT FORUM_MEMBERS_PENDING.MEMBER_ID, FORUM_MEMBERS_PENDING.M_STATUS, FORUM_MEMBERS_PENDING.M_NAME, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_USERNAME, FORUM_MEMBERS_PENDING.M_PASSWORD, FORUM_MEMBERS_PENDING.M_EMAIL, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_COUNTRY, FORUM_MEMBERS_PENDING.M_HOMEPAGE, FORUM_MEMBERS_PENDING.M_SIG, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_VIEW_SIG, FORUM_MEMBERS_PENDING.M_SIG_DEFAULT, FORUM_MEMBERS_PENDING.M_DEFAULT_VIEW, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_LEVEL, FORUM_MEMBERS_PENDING.M_AIM, FORUM_MEMBERS_PENDING.M_ICQ, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_MSN, FORUM_MEMBERS_PENDING.M_YAHOO, FORUM_MEMBERS_PENDING.M_POSTS, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_DATE, FORUM_MEMBERS_PENDING.M_LASTHEREDATE, FORUM_MEMBERS_PENDING.M_LASTPOSTDATE, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_TITLE, FORUM_MEMBERS_PENDING.M_SUBSCRIPTION, FORUM_MEMBERS_PENDING.M_HIDE_EMAIL, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_RECEIVE_EMAIL, FORUM_MEMBERS_PENDING.M_LAST_IP, FORUM_MEMBERS_PENDING.M_IP, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_FIRSTNAME, FORUM_MEMBERS_PENDING.M_LASTNAME, FORUM_MEMBERS_PENDING.M_OCCUPATION, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_SEX, FORUM_MEMBERS_PENDING.M_AGE, FORUM_MEMBERS_PENDING.M_DOB, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_HOBBIES, FORUM_MEMBERS_PENDING.M_LNEWS, FORUM_MEMBERS_PENDING.M_QUOTE, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_BIO, FORUM_MEMBERS_PENDING.M_MARSTATUS, FORUM_MEMBERS_PENDING.M_LINK1, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_LINK2, FORUM_MEMBERS_PENDING.M_CITY, FORUM_MEMBERS_PENDING.M_STATE, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_PHOTO_URL, FORUM_MEMBERS_PENDING.M_KEY, FORUM_MEMBERS_PENDING.M_NEWEMAIL, "
strSqldel = strSqldel & "FORUM_MEMBERS_PENDING.M_PWKEY, FORUM_MEMBERS_PENDING.M_APPROVE, FORUM_MEMBERS_PENDING.M_SHA256 "
strSqldel = strSqldel & "FROM FORUM_MEMBERS_PENDING "
strSqldel = strSqldel & "WHERE MEMBER_ID = " & aryIDdel(i)

my_Conn.Execute (strSqldel),,adCmdText + adExecuteNoRecords
next

aryID = split(selID, ",")
for i = 0 to ubound(aryID)
'## Forum_SQL - Delete the Member
strSql = "DELETE FROM " & strMemberTablePrefix & "MEMBERS_PENDING "
strSql = strSql & " WHERE MEMBER_ID = " & aryID(i)

my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
next
Response.Write " <br /><p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """><b>Members Deleted!</b></font></p>" & vbNewLine & _
" <meta http-equiv=""Refresh"" content=""2; URL=admin_accounts_pending.asp" & strPage & """>" & vbNewLine & _
" <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """>Selected members have been deleted!</font></p>" & vbNewLine & _
" <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""admin_accounts_pending.asp" & strPage & """>Back To Members Pending</font></a></p><br />" & vbNewLine
WriteFooter
Response.End
end if
end if


Make a backup BEFORE you test or try this modification!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.4 seconds. Powered By: Snitz Forums 2000 Version 3.4.07