lilaccrafts
Starting Member
18 Posts |
Posted - 24 April 2004 : 19:56:25
|
A recent post requested that he wanted moderators to have the ability to ban certain members and at the same time they do not have to go in and allow new members.
This will auto insert any new member in the allowed members list so you do not have to. Granted that you have private forums enabled. All the moderator has to do is click on the name he wants out. If your forum is running then you will have to go into the forum properties and allow all members then start removing the ones you want out. thats it.
This was modified and used from usergroups MOD by Nikkol
In the register.asp file Insert all red code
Around line 189
Call DoCount
Call UserGroupAutoJoin(chkString(rsKey("M_NAME"),"SQLString")) '####### Autoinsertmember MOD #######
'## Forum_SQL - Delete the Member strSql = "DELETE FROM " & strMemberTablePrefix & "MEMBERS_PENDING " strSql = strSql & " WHERE M_KEY = '" & key & "'"
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords </tr> <tr> <td width="50%" valign="top">approximately line 577 add:<br> <a href="#" onClick="document.getElementById('ta22').select();return false;">Select All<br> </a> <textarea wrap="off" name="ta22" rows="1" cols="20">'####### Begin Autoinsertmember MOD ####### if strAutoLogon = "1" then Call UserGroupAutoJoin(chkString(Session(strCookieURL & "strNTUserFullName"),"SQLString")) else Call UserGroupAutoJoin(chkString(trim(Request.Form("Name")),"SQLString")) end if '####### End Autoinsertmember MOD #######
Around line 875
txtBadWordWords = Application(strCookieURL & "STRBADWORDWORDS") fString = trim(pString) bwords = split(txtBadWordWords, ",") for i = 0 to ubound(bwords) if instr(1,lcase(fString), lcase(bwords(i)),1) <> 0 then Err_Msg = Err_Msg & "<li>Username may not contain the word <b>" & bwords(i) & "</b></li>" exit function end if next end function '####### Begin Autoinsertmember MOD ####### Sub UserGroupAutoJoin(strNewMemberName) strSql = "SELECT FORUM_ID FROM " & strTablePrefix & "FORUM " &_ "WHERE F_PRIVATEFORUMS = 1" set rsAutoJoin = my_Conn.execute(strSql) arAutoJoin = Null if not rsAutoJoin.bof and not rsAutoJoin.eof then arAutoJoin = rsAutoJoin.GetRows rsAutoJoin.close set rsAutoJoin = Nothing if not IsNull(arAutoJoin) then for AJCnt = LBound(arAutoJoin,2) to UBound(arAutoJoin,2) strSql = "SELECT MEMBER_ID FROM " & strMemberTablePrefix & "MEMBERS " &_ "WHERE M_NAME = '" & strNewMemberName & "'" set rsUser = my_Conn.execute(strSql) if not rsUser.bof and not rsUser.eof then strSql = "INSERT INTO " & strTablePrefix & "ALLOWED_MEMBERS " &_ "(FORUM_ID, MEMBER_ID) VALUES " &_ "(" & arAutoJoin(0,AJCnt) & ", " & rsUser("MEMBER_ID") & ")" my_Conn.execute(strSql) end if rsUser.close set rsUser = Nothing next end if
End Sub '####### End autoinsertmember MOD ####### %>
(important)Make Sure when editing the forum properties you have allow members list selected as Auth Type:
Now I haven't tried this without the usergroup mod installed!!!!!! so be warned..... If it doesnt work then install the usergroup mod and add the above sub with the usergroup sub
It would look like this
Sub UserGroupAutoJoin(strNewMemberName) strSql = "SELECT FORUM_ID FROM " & strTablePrefix & "FORUM " &_ "WHERE F_PRIVATEFORUMS = 1" set rsAutoJoin = my_Conn.execute(strSql) arAutoJoin = Null if not rsAutoJoin.bof and not rsAutoJoin.eof then arAutoJoin = rsAutoJoin.GetRows rsAutoJoin.close set rsAutoJoin = Nothing if not IsNull(arAutoJoin) then for AJCnt = LBound(arAutoJoin,2) to UBound(arAutoJoin,2) strSql = "SELECT MEMBER_ID FROM " & strMemberTablePrefix & "MEMBERS " &_ "WHERE M_NAME = '" & strNewMemberName & "'" set rsUser = my_Conn.execute(strSql) if not rsUser.bof and not rsUser.eof then strSql = "INSERT INTO " & strTablePrefix & "ALLOWED_MEMBERS " &_ "(FORUM_ID, MEMBER_ID) VALUES " &_ "(" & arAutoJoin(0,AJCnt) & ", " & rsUser("MEMBER_ID") & ")" my_Conn.execute(strSql) end if rsUser.close set rsUser = Nothing next end if
strSql = "SELECT USERGROUP_ID FROM " & strTablePrefix & "USERGROUPS " &_ "WHERE AUTOJOIN = 1" set rsAutoJoin = my_Conn.execute(strSql) arAutoJoin = Null if not rsAutoJoin.bof and not rsAutoJoin.eof then arAutoJoin = rsAutoJoin.GetRows rsAutoJoin.close set rsAutoJoin = Nothing if not IsNull(arAutoJoin) then for AJCnt = LBound(arAutoJoin,2) to UBound(arAutoJoin,2) strSql = "SELECT MEMBER_ID FROM " & strMemberTablePrefix & "MEMBERS " &_ "WHERE M_NAME = '" & strNewMemberName & "'" set rsUser = my_Conn.execute(strSql) if not rsUser.bof and not rsUser.eof then strSql = "INSERT INTO " & strTablePrefix & "USERGROUP_USERS " &_ "(USERGROUP_ID, MEMBER_ID, MEMBER_TYPE) VALUES " &_ "(" & arAutoJoin(0,AJCnt) & ", " & rsUser("MEMBER_ID") & ", 1)" my_Conn.execute(strSql) end if rsUser.close set rsUser = Nothing next end if End Sub
If you install the usergroup mod using access database then you must remove this in the admin_usergroups.asp remove the code in red
set rsGroup = my_conn.execute("SELECT USERGROUP_ID FROM " & strTablePrefix & "USERGROUPS ORDER BY USERGROUP_ID DESC LIMIT 0,1")
New Code
set rsGroup = my_conn.execute("SELECT USERGROUP_ID FROM " & strTablePrefix & "USERGROUPS ORDER BY USERGROUP_ID DESC ")
Hope this helps? usergroups and this modification is working with no problems.
|
Edited by - lilaccrafts on 24 April 2004 22:37:04 |
|