Author |
Topic |
|
bcales
Starting Member
10 Posts |
Posted - 15 March 2005 : 19:21:14
|
I took Nikkol's User Group Mod, and implemented it.
Works awesome.
Well then I wanted to allow moderators to create their own groups and manage them.
I'm not good at writing MODs, but it seems to work great.
I made changes to: usergroups.asp, admin_usergroups.asp, post.asp, and pop_profile.asp.
The user must be moderator level. They can create userGroups They can modify userGroups on Forums that they moderate They can delete userGroups that they created They cannot see or edit userGroups from other moderators. - they can view if the access is granted.
This is an option to allow moderator created groups.
If the moderator, is changed to a normal user, all his custom groups are reassigned to the person who changes his status.
I will work on quick documentation to this update and post soon. If you want the complete files, I will email them to you. - This is the only mod I have off of 3.4
|
|
bcales
Starting Member
10 Posts |
Posted - 15 March 2005 : 19:53:46
|
1. Insert STRUGMODCREATE with value = 0 into CONFIG_NEW table 2. Add MOD_ID as a field into USERGROUPS table
3. admin_usergroups.asp Line 46 'if Session(strCookieURL & "Approval") <> "15916941253" then ' scriptname = split(request.servervariables("SCRIPT_NAME"),"/") ' strQS = request.querystring ' Response.Redirect "admin_login.asp?target=" & Server.URLEncode(scriptname(ubound(scriptname)) & "?" & strQS) 'end if
'###COV UserGroups Moderator Access BEGIN scriptname = split(request.servervariables("SCRIPT_NAME"),"/") strQS = request.querystring if mLev = 4 OR (mLev = 3 AND strUGModCreate = "1") Then '## Do Nothing else '"Only moderators and administrators can edit user groups" Response.Redirect "admin_login.asp?target=" & Server.URLEncode(scriptname(ubound(scriptname)) & "?" & strQS) end if '###COV UserGroups Moderator Access END Line 88 If UserGroupActionMode = "Delete" Or UserGroupActionMode = "Modify" Then GroupID = Request.Querystring("ID") '###COV UserGroups Moderator Access BEGIN strSql = "SELECT MOD_ID " strSql = strSql & "FROM " & strTablePrefix & "USERGROUPS " strSql = strSql & "WHERE USERGROUP_ID = " & GroupID If mLev <> 4 Then strSql = strSql & " AND MOD_ID = " & MemberID set rsGroup = Server.CreateObject("ADODB.Recordset") rsGroup.open strSql, my_Conn, 3 If rsGroup.eof Then Response.Redirect "admin_login.asp?target=" & Server.URLEncode(scriptname(ubound(scriptname)) & "?" & strQS) End If rsGroup.Close set rsGroup = Nothing '###COV UserGroups Moderator Access END End If Line 104 If UserGroupActionMode = "Modify" Then '###COV UserGroups Moderator Access ADD MOD_ID strSql = "SELECT USERGROUP_NAME, USERGROUP_DESC, MEM_HIDE, MOD_HIDE, AUTOJOIN, MOD_ID " strSql = strSql & "FROM " & strTablePrefix & "USERGROUPS " strSql = strSql & "WHERE USERGROUP_ID = " & GroupID set rsGroup = Server.CreateObject("ADODB.Recordset") ' rsGroup.cachesize=20 'fix for mysql problem rsGroup.open strSql, my_Conn, 3 GroupName = rsGroup("USERGROUP_NAME") GroupDesc = rsGroup("USERGROUP_DESC") MemHideGroup = rsGroup("MEM_HIDE") ModHideGroup = rsGroup("MOD_HIDE") GroupAutoJoin = rsGroup("AUTOJOIN") '###COV UserGroups Moderator Access ADD MOD_ID ModID = rsGroup("MOD_ID") rsGroup.Close set rsGroup = Nothing End If Line 224 " </tr>" & vbNewLine '###COV UserGroups Moderator Access BEGIN Response.write "" &_ " <tr>" & vbNewLine & _ " <td bgColor=""" & strPopUpTableColor & """ noWrap align=""right"">" & vbNewLine & _ " <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>Moderator:</b></font></td>" & vbNewLine & _ " <td bgColor=""" & strPopUpTableColor & """ noWrap align=""left""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _ " <input style=""width:100%;"" type=""hidden"" name=""ModID"" size=""50"" value=""" & ChkString(ModID,"edit") & """>" & ChkString(getMemberName(ModID),"edit") & "</font></td>" & vbNewLine & _ " </tr>" & vbNewLine '###COV UserGroups Moderator Access END Response.Write "" &_ " <tr>" & vbNewLine & _ Line 246 " <td bgColor=""" & strPopUpTableColor & """ noWrap align=""left""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine Response.Write "" &_ " <input type=""checkbox"" name=""MemHideGroup"" value=""on""" & chkCheckBox(MemHideGroup,1,true) & "> Hidden from members<br />" & vbNewline '###COV UserGroups Moderator Access BEGIN If mLev = 4 Then Response.Write "" &_ " <input type=""checkbox"" name=""ModHideGroup"" value=""on""" & chkCheckBox(ModHideGroup,1,true) & "> Hidden from forum moderators<br />" & vbNewline &_ " <input type=""checkbox"" name=""GroupAutoJoin"" value=""on""" & chkCheckBox(GroupAutoJoin,1,true) & "> Auto-join for new members on registration<br />" & vbNewline '###COV UserGroups Moderator Access END End If Line 273strSqlG = "SELECT USERGROUP_ID, USERGROUP_NAME " strSqlG = strSqlG & " FROM " & strTablePrefix & "USERGROUPS " strSqlG = strSqlG & " WHERE USERGROUP_ID <> " & GroupID '###COV UserGroups Moderator Access 1 line If mLev <> 4 Then strSqlG = strSqlG & " AND MOD_ID = " & MemberID Line 414 for FCount = LBound(arF,2) to UBound(arF,2) strSql = "SELECT PERMS FROM " & strTablePrefix & "ALLOWED_USERGROUPS WHERE " strSql = strSql & "FORUM_ID = " & arF(0,FCount) strSql = strSql & " AND USERGROUP_ID = " & GroupID set rsPerms = my_Conn.execute(strSql) strPerms = "" if not rsPerms.BOF and not rsPerms.EOF then strPerms = rsPerms(0) rsPerms.Close set rsPerms = Nothing '###COV UserGroups Moderator Access BEGIN If mLev = 4 OR (chkForumModerator(arF(0,FCount), Session(strCookieURL & "username")) = 1) Then response.write " <tr>" & vbNewline &_ " <td><a href=""post.asp?method=EditForum&FORUM_ID=" & arF(0,FCount) & "&CAT_ID=" & arCat(0,CatCount) & "&type=0"">" & getCurrentIcon(strIconFolderPencil,"Edit Forum Properties","hspace=""0""") & "</a></td>" & vbNewline &_ " <td><font size=""" & strDefaultFontSize & """>" & chkString(arF(2,FCount),"display") & "</font></td>" & vbNewline &_ " <td align=""right""><font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """><select name=""Perms" & arF(0,FCount) & """>" & vbNewline &_ " <option value=""notset""" if strPerms = "" then response.write " selected" response.write ">Do Not Set</option>" & vbNewline if (arF(1,FCount) = 1 or arF(1,FCount) = 6 or arF(1,FCount) = 3) then response.write " <option value=""0""" if strPerms = "0" then response.write " selected" response.write ">Allow</option>" & vbNewline end if response.write " <option value=""2""" if strPerms = "2" then response.write " selected" response.write ">Read-Only</option>" & vbNewline response.write " <option value=""1""" if strPerms = "1" then response.write " selected" response.write ">Deny</option>" & vbNewline &_ " </select></font></td>" & vbNewline &_ " </tr>" & vbNewline Else If ChkForumAccess(arF(0,FCount), MemberID, false) = True Then response.write " <tr>" & vbNewline &_ " <td></td>" & vbNewline &_ " <td><font size=""" & strDefaultFontSize & """>" & chkString(arF(2,FCount),"display") & "</font></td>" & vbNewline &_ " <td align=""right""><font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """>-</font></td>" & vbNewline Else End If End If '###COV UserGroups Moderator Access END Next Line 487 Case Else '###COV UserGroups Moderator Access BEGIN If mLev = 4 then Response.Write " Line 542 " <input type=""radio"" name=""strUGMemView"" value=""2""" & chkRadio(strUGMemView,2,true) & " />All Members" & vbNewline &_ " </font></td>" & vbNewline &_ " </tr>" & vbNewLine '###COV UserGroups Moderator Access BEGIN_SUB Response.Write " <tr valign=""middle"">" & vbNewLine & _ " <td bgColor=""" & strPopUpTableColor & """ align=""right""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>Moderator Access to Create UserGroups: </b></font><br /><font size=""" & strFooterFontSize & """>(Create/Modify/Delete UserGroups owned by Moderator) </font></td>" & vbNewLine & _ " <td bgColor=""" & strPopUpTableColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _ " <select name=""strUGModCreate"">" & vbNewline &_ " <option value=""0""" & chkSelect(strUGModCreate,0) & ">No</option>" & vbNewline &_ " <option value=""1""" & chkSelect(strUGModCreate,1) & ">Yes</option>" & vbNewline &_ " </select>" & vbNewline &_ " </font></td>" & vbNewline &_ " </tr>" & vbNewLine '###COV UserGroups Moderator Access END_SUB Response.Write " <tr valign=""middle"">" & vbNewLine & _ " <td bgColor=""" & strPopUpTableColor & """ align=""right""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><b>Moderator Access to Forum UserGroup Permissions: </b></font><br /><font size=""" & strFooterFontSize & """>(View and Edit allow moderators to view UserGroup members) </font></td>" & vbNewLine & _ " <td bgColor=""" & strPopUpTableColor & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _ " <select name=""strUGModForums"">" & vbNewline &_ " Line 567 " <td bgColor=""" & strPopUpTableColor & """ colspan=""2"" align=""center""><input type=""submit"" value=""Submit New Config"" id=""submit1"" name=""submit1""> <input type=""button"" onClick=""document.location.href='admin_usergroups.asp';"" value=""Reset Old Values"" id=""reset1"" name=""reset1""></td>" & vbNewLine & _ " </tr>" & vbNewLine & _ " </table>" & vbNewLine & _ " </td>" & vbNewLine & _ " </tr>" & vbNewLine & _ " </table>" & vbNewLine & _ " </form>" & vbNewLine &_ " <script type=""text/javascript"" language=""javascript"">limitValues();</script>" & vbNewline End If '###COV UserGroups Moderator Access END Line 585 " <td nowrap align=""center"" bgcolor=""" & strHeadCellColor & """><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHeadFontColor & """>" & vbNewLine '###COV UserGroups Moderator Access BEGIN If mLev = 4 or mLev = 3 Then Response.Write " <a href=""admin_usergroups.asp?mode=Add"">" & getCurrentIcon(strIconGroup,"Add UserGroup ...","hspace=""0""") & "</a></font></b>" Response.Write "</td>" & vbNewLine '###COV UserGroups Moderator Access END Response.Write " </tr>" & vbNewLine Line 592 '## Forum_SQL - Find all records with the search criteria in them strSql = "SELECT " & strTablePrefix & "USERGROUPS.USERGROUP_ID, " strSql = strSql & strTablePrefix & "USERGROUPS.USERGROUP_NAME, " strSql = strSql & strTablePrefix & "USERGROUPS.USERGROUP_DESC, " strSql = strSql & strTablePrefix & "USERGROUPS.MOD_ID " strSql = strSql & " FROM " & strTablePrefix & "USERGROUPS " '###COV UserGroups Moderator Access 1 line If mLev <> 4 Then strSql = strSql & " WHERE "& strTablePrefix & "USERGROUPS.MOD_ID = " & MemberId
4. config.asp a. ADD - strUGModCreate = Application(strCookieURL & "STRUGMODCREATE") '###COV UserGroups Moderator Access
5. pop_profile.asp a. after it updates the members table add the following '###COV UserGroups Moderator Access BEGIN If cLng("0" & Request.Form("Level")) = "1" Then strSql = "UPDATE " & strMemberTablePrefix & "USERGROUPS " strSql = strSql & " SET MOD_ID = '" & MemberID & "'" strSql = strSql & " WHERE MOD_ID = " & cLng(Request.Form("MEMBER_ID")) my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords End If '###COV UserGroups Moderator Access END
6. post.asp Line 1320 strSql = "SELECT USERGROUP_ID, USERGROUP_NAME, MOD_HIDE " strSql = strSql & " FROM " & strTablePrefix & "USERGROUPS " '###COV UserGroups Moderator Access 1 Line if mLev <> 4 Then strSql = strSql & " WHERE MOD_ID = " & MemberID & "" strSql = strSql & " ORDER BY USERGROUP_NAME "
7. usergroups.asp Line 101 Case "ViewGroups" '## grab UserGroups from the db '###COV UserGroups Moderator Access ADD MOD_ID strSql = "SELECT USERGROUP_ID, USERGROUP_NAME, USERGROUP_DESC, MEM_HIDE, MOD_ID " &_ "FROM " & strTablePrefix & "USERGROUPS" Line 108 Case 3 if CInt(strUGModForums) > 0 then strSql = strSql & " WHERE MOD_HIDE = 0" else strSql = strSql & " WHERE MEM_HIDE = 0" if CInt(strUGView) = 1 then strSql = strSql & " AND USERGROUP_ID IN (" & Trim(Session(strCookieURL & "UserGroups" & MemberID)) & ")" end if '###COV UserGroups Moderator Access ADD MOD_ID strSql = strSql & " AND MOD_ID = " & MemberID & "" Case Else Line 126 set rsGroups = Nothing Response.Write " <tr>" & vbNewLine &_ " <td bgcolor=""" & strHeadCellColor & """><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHeadFontColor & """>UserGroup Name</font></b></td>" & vbNewLine & _ " <td bgcolor=""" & strHeadCellColor & """><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHeadFontColor & """>UserGroup Description</font></b></td>" & vbNewLine & _ " <td nowrap align=""center"" bgcolor=""" & strHeadCellColor & """><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHeadFontColor & """>" '###COV UserGroups Moderator Access BEGIN if mlev = 4 or (mlev = 3 AND strUGModCreate = "1") then response.write "<a href=""admin_usergroups.asp"" alt=""UserGroups Manager"">" & getCurrentIcon(strIconGroup,"UserGroups Manager","hspace=""0""") & "</a>" else response.write " " end if '###COV UserGroups Moderator Access END Response.write "</font></b></td>" & vbNewLine & _ Line 147 " <td nowrap valign=""top"" align=""center"" bgcolor=""" & strForumCellColor & """>" & vbNewline '###COV UserGroups Moderator Access BEGIN If mlev = 4 OR (MemberID = arGroups(4,GCnt) AND strUGModCreate = "1") Then Response.Write " <a href=""usergroups.asp?mode=ViewUsers&ID=" & arGroups(0,GCnt) & """ alt=""View Users in this UserGroup"">" & getCurrentIcon(strIconGroup,"View Users in this UserGroup","hspace=""0""") & "</a>" & vbNewline response.write " <a href=""admin_usergroups.asp?mode=Modify&ID=" & arGroups(0,GCnt) & """ alt=""Modify this UserGroup"">" & getCurrentIcon(strIconPencil,"Modify this UserGroup","hspace=""0""") & "</a>" & vbNewline End If '###COV UserGroups Moderator Access END Response.write " </td>" & vbNewLine & _
|
Edited by - bcales on 15 March 2005 19:56:37 |
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 16 March 2005 : 04:08:10
|
Nice work, and a great idea! Just wondering ; is Nikkol's mod easy to implement ? I haven't dared to install it yet. |
portfolio - linkshrinker - oxle - twitter |
|
|
healthee
Starting Member
2 Posts |
Posted - 22 March 2005 : 11:50:35
|
Can't find the usergroup mod? Any url to it? |
|
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 22 March 2005 : 12:24:15
|
I think this was the latest version.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
|
Topic |
|
|
|