Alright, this code is not the best coding you find here but I have no idea what the all the variables are for moderating the forums. This code has only been tested on SQL Server 7.0...and well I don't think its that reliable, but it works.
All this code does is limit your normal users to send messages to only moderators and administrators. Members can also send message to all the moderators of a specific forum. You can use this in conjuction with the private messaging feature of emailing all users or replace it with this.
You need the Private Messaging Mod and the the Mod which allows you to send a message to multiple users.
Approximate Line # 119
Msg = ""
moderatorlevel = 2
'## Get a List of all the Moderators & Administrators
strSQL = "SELECT m_name, m_level, member_id "
strSQL = strSQL & " FROM Forum_Members "
strSQL = strSQL & " WHERE m_level = " & moderatorlevel
set aus = my_conn.Execute (strSQL)
if Request.Querystring("method") = "ReplyQuote" or Request.Querystring("method") = "Forward" then
Approximate Line # 232
Replace
<input name="sendto" value="<% =Request.Querystring("mname") %>" size="50">
with:
<%if (mLev = 4 or mLev = 3) then %>
<input name="sendto" value="<% =Request.Querystring("mname") %>" size="50">
<% else %>
<select size="1" name="sendto">
<% 'CODING FOR SENDING TO MODS AND ADMINS %>
<option value="admin">Administrator</option>
<% '## Select Moderators
'select distinct forums
strSQL = "SELECT forum_id, f_subject FROM forum_forum "
set fmd = my_conn.Execute (strSQL)
do until fmd.Eof
f_subject = fmd("f_subject")
forum_subject = "All Moderators : " & f_subject
'select moderators of each forum
strSQL = "SELECT mod_id, forum_id, member_id FROM forum_moderator WHERE forum_id =" &fmd("forum_id")
set smod = my_conn.Execute (strSQL)
modvalue = "admin,tyles"
do until smod.Eof
'select username of the moderator of each forum
strSQL = "SELECT m_name, member_id FROM Forum_Members WHERE member_id =" & smod("member_id")
set smod2 = my_conn.Execute(strSQL)
mod_name = smod2("m_name")
modvalue = modvalue & "," & mod_name
smod.MoveNext
Loop
if modvalue <> "admin" then
response.write "<option value='" & modvalue & "'>" & forum_subject & "</option>"
end if
fmd.MoveNext
Loop
modvalue = "admin"
%>
<% do until aus.Eof
%>
<option <% if request.querystring("mname") = aus("m_name") then response.write " selected" %>>Moderator : <% =aus("m_name") %></option>
<%
aus.moveNext
Loop
'DONE
%>
</select>
<% end if %>
As you can see the code is not that impressive. I have not used the strMemberTablePrefix or anything like that (mostly because I don't know what it stands for). The code works fine if you haven't renamed any of the tables or changed the table prefix from Forum_ to something else.
Please keep in mind that you do need the multiple users mod (allows you to send messages to multiple users).