Well, I'm happy to say that after messing around with the code for the past 12 hours or so (my eyes hurt) I have a workable solution. Is it the best possible solution? Well, probably not, but I'm open to some guru taking my example, cleaning it up and writing it in as a feature in the future (attn: boRg
). I resorted to using an SQL insert statement to change the database because I was having troubles with writing using rsCommon.
All modifications were done to functions_members_API.asp. Line markers are estimates and may be off by a few.
Line 90 (insert):
Dim strGroup
Dim oldGroupID
Line 98 (insert):
'Get the current user group ID passed in your session; rename Group to whatever you called your session variable
strGroup = Session("Group")
Line 109 (replace):
strSQL = "SELECT " & strDbTable & "Author.Password, " & strDbTable & "Author.Salt, " & strDbTable & "Author.Username, " & strDbTable & "Author.Author_ID, " & strDbTable & "Author.User_code, " & strDbTable & "Author.Active, " & strDbTable & "Author.Login_attempt, " & strDbTable & "Author.Group_ID " & _
Line 139 (insert):
oldGroupID = rsCommon("Group_ID")
Line 194 (insert):
'If the Session Group_ID does not match that on record we need to overwrite it in the db
If NOT strGroup = oldGroupID Then
'Set the forum group ID number for an Existing Member
'Check tblPermissions for values used below
'1 = Adminsitrator (reserved for Admin only)
'2 = Guest (default)
'3 = Moderator (all User Admins)
'4 = Newbie
'5 = Operator
'6 = Power User
If strGroup = 1 or strGroup = 2 Then
intForumStartingGroup = 5
ElseIf strGroup = 3 Then
intForumStartingGroup = 6
ElseIf strGroup = 4 Then
intForumStartingGroup = 3
ElseIf strGroup = 9 Then
intForumStartingGroup = 1
Else
intForumStartingGroup = 2
End If
'Setup SQL statement to update tblAUthor db with new Group_ID
strSQL2 = "UPDATE " & strDbTable & "Author " & strRowLock & _
" SET Group_ID=" & intForumStartingGroup & _
" WHERE Author_ID =" & lngUserID & ";"
'Set error trapping
On Error Resume Next
'Write SQL query to the db
adoCon.Execute(strSQL2)
'If an error has occured write an error to the page
If Err.Number <> 0 Then Call errorMsg("An error has occured while writing to the database.", "existingMemberAPI()_update_pass", "functions_member_API.asp")
'Disable error trapping
On Error goto 0
End If
*EDIT* Oops, I lied. I made one addition to database_connections.asp for the SQL statement I ran.
Line 73 (insert):
Dim strSQL2
Edited by gariputro - 19 October 2006 at 8:02pm