Author |
Topic |
|
jfitz
Junior Member
USA
345 Posts |
Posted - 30 April 2003 : 22:47:20
|
USER PROBATION MOD
I have been asked to show the code that I used to place members on probation. It's pretty simple, but it does require adding a field to the MEMBERS table, and I don't yet understand mods well enough to create the data base update component, so I didn't think I should post this topic in the MOD W/Code section.
Caution: I have only used this code on my forum, which requires registration prior to posting. If your forum does not require registration prior to posting, then the whole concept of user probation doesn't apply, and this code probably does not make any sense to use.
If you have the GauravBhabu's User Level Moderation Mod installed (I do), this code tracks very closely with that mod, and can be implemented in the same code locations.
Requirements:
1. Add one integer field to MEMBERS table
2. Update base code at five locations, three files affected. At each of the five locations, code is added. No baseline code is removed.
3. Add one new ASP page to create Admin function to set / update user probation status.
==================================================================
1. Add one integer field to your MEMBERS table. I called this field Z_PROBATION. Set the field default value to zero (zero indicates not on probation, 1 indicates probationary status)
2. Make the following changes in the indicated files (INC_HEADER.ASP, INC_FUNC_COMMON.ASP, and POST_INFO.ASP)
INC_HEADER.ASP
Around line 42 (i.e., at the beginning of the script code, add the following to define and initialize the internal user probation flag:
'###### User Probation Mod
dim user_on_probation
user_on_probation = FALSE'######
INC_FUNC.COMMON.ASP
Modify the chkUser function to read the data base probation status when the user logs in.
Find the SQL string definition at the top of the function and add the additional select field at the end of the statement
'## Forum_SQL
strSql = "SELECT MEMBER_ID, M_LEVEL, M_NAME, M_PASSWORD, M_POSTS, Z_PROBATION " ' ###### User Probation Mod
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
Approximately 15-16 lines later, add the indicated (red) code to set the internal flag from the data base
MemberID = rsCheck("MEMBER_ID")
if rsCheck("Z_PROBATION") = 1 then
user_on_probation = TRUE
else
user_on_probation = FALSE
end if
POST_INFO.ASP
Use the internal flag to set moderation required during message posting. Find the code fragment shown, and add the indicated (red)lines (probably around line 325 or so) in the place shown
' If Creating a new topic or reply, the subscription and moderation capabilities will need to be checked.
Moderation = "No"
if MethodType = "Topic" or _
MethodType = "Edit" or _
MethodType = "Reply" or _
MethodType = "ReplyQuote" or _
MethodType = "TopicQuote" or _
MethodType = "Forum" or _
MethodType = "EditForum" then
if strModeration > 0 or strSubscription > 0 then
'## Forum_SQL - Get the Cat_Subscription, Cat_Moderation, Forum_Subscription, Forum_Moderation
strSql = "SELECT C.CAT_MODERATION, C.CAT_SUBSCRIPTION, C.CAT_NAME "
if MethodType <> "Forum" then
strSql = strSql & ", F.F_MODERATION, F.F_SUBSCRIPTION "
end if
strsql = strsql & " FROM " & strTablePrefix & "CATEGORY C"
if MethodType <> "Forum" then
strSql = strSql & ", " & strTablePrefix & "FORUM F"
end if
strSql = strSql & " WHERE C.CAT_ID = " & Cat_ID
if MethodType <> "Forum" then
strSql = strSql & " AND F.FORUM_ID = " & Forum_ID
end if
set rsCheck = my_Conn.Execute (strSql)
CatName = rsCheck("CAT_NAME")
CatSubscription = rsCheck("CAT_SUBSCRIPTION")
CatModeration = rsCheck("CAT_MODERATION")
if MethodType <> "Forum" then
ForumSubscription = rsCheck("F_SUBSCRIPTION")
ForumModeration = rsCheck("F_MODERATION")
end if
rsCheck.Close
set rsCheck = nothing
if MethodType <> "Forum" then
'## Moderators and Admins are not subject to Moderation
if strModeration = 0 or mlev = 4 or chkForumModerator(Forum_ID, strDBNTUserName) = "1" then
Moderation = "No"
'## Is Moderation allowed on the category?
elseif CatModeration = 1 then
'## if this is a topic, is forum moderation set to all posts or topic?
if (ForumModeration = 1 or ForumModeration = 2) and (MethodType = "Topic") then
Moderation = "Yes"
'## if this is a reply, is forum moderation set to all posts or reply?
elseif (ForumModeration = 1 or ForumModeration = 3) and (MethodType <> "Topic") then
Moderation = "Yes"
'###### User Probation Moderation Mod
elseif (user_on_probation = TRUE) then
Moderation = "Yes"
'###### end if
end if
end if
end if
end if
3. Copy the following new file to your forum directory and invoke it to update a specified user's probation status. This is a plain vanilla page that takes a member number (you must know the member id) and probation status, and updates the MEMBERS table in the data base.
I did not modify ADMIN_HOME.ASP to add a link to this page as a menu item, but it is easily done.
ADMIN_SET_PROBATION.ASP
<%
'#################################################################################
'## Copyright (C) 2000-02 Michael Anderson, Pierre Gorissen,
'## Huw Reddick and Richard Kinser
'##
'## This program is free software; you can redistribute it and/or
'## modify it under the terms of the GNU General Public License
'## as published by the Free Software Foundation; either version 2
'## of the License, or any later version.
'##
'## All copyright notices regarding Snitz Forums 2000
'## must remain intact in the scripts and in the outputted HTML
'## The "powered by" text/logo with a link back to
'## http://forum.snitz.com in the footer of the pages MUST
'## remain visible when the pages are viewed on the internet or intranet.
'##
'## This program is distributed in the hope that it will be useful,
'## but WITHOUT ANY WARRANTY; without even the implied warranty of
'## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
'## GNU General Public License for more details.
'##
'## You should have received a copy of the GNU General Public License
'## along with this program; if not, write to the Free Software
'## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
'##
'## Support can be obtained from support forums at:
'## http://forum.snitz.com
'##
'## Correspondence and Marketing Questions can be sent to:
'## reinhold@bigfoot.com
'##
'## or
'##
'## Snitz Communications
'## C/O: Michael Anderson
'## PO Box 200
'## Harpswell, ME 04079
'#################################################################################
%>
<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_sha256.asp"-->
<!--#INCLUDE FILE="inc_header.asp" -->
<%
if Session(strCookieURL & "Approval") <> "15916941253" then
scriptname = split(request.servervariables("SCRIPT_NAME"),"/")
Response.Redirect "admin_login.asp?target=" & scriptname(ubound(scriptname))
end if
Response.Write " <script language=""JavaScript"" type=""text/javascript"">" & vbNewLine & _
" function ChangePage(fnum){" & vbNewLine & _
" if (fnum == 1) {" & vbNewLine & _
" document.PageNum1.submit();" & vbNewLine & _
" }" & vbNewLine & _
" else {" & vbNewLine & _
" document.PageNum2.submit();" & vbNewLine & _
" }" & vbNewLine & _
" }" & vbNewLine & _
" </script>" & vbNewLine
DIM my_script, my_action, my_id, my_stat, sql_str
my_script = Request.servervariables("SCRIPT_NAME")
my_action = Request("action")
my_id = Request("memberid")
my_stat = Request("memberstat")
if my_action="update" then
if (my_id <> "") and (my_stat<>"") then
sql_str = "UPDATE " & strMemberTablePrefix & "MEMBERS SET Z_PROBATION=" & my_stat & " WHERE MEMBER_ID=" & my_id
Response.Write sql_str
my_Conn.Execute (sql_str),,adCmdText + adExecuteNoRecords
end if
end if
Response.Write " <table border=""0"" align=center width=""100%"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""left"" nowrap><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" " & getCurrentIcon(strIconFolderOpen,"","") & " <a href=""default.asp"">All Forums</a><br />" & vbNewLine & _
" " & getCurrentIcon(strIconBar,"","") & getCurrentIcon(strIconFolderOpen,"","") & " <a href=""admin_home.asp"">Admin Section</a><br />" & vbNewLine & _
" " & getCurrentIcon(strIconBlank,"","") & getCurrentIcon(strIconBar,"","") & getCurrentIcon(strIconFolderOpenTopic,"","") & " Set Member Probation<br /><br /></font></td>" & vbNewLine & _
" </tr>" & vbNewLine
Response.Write " </table><br />" & vbNewLine
Response.Write "<form name=""form1"" method=""post"" action=""" & my_script & "?action=update"">" & vbNewLine
Response.Write " <table>" & vbNewLine
Response.Write " <tr><td>Member ID: </td><td>"
Response.Write "<input type=""text"" name=""memberid"" maxlength=""5"" size=""5""></td></tr>" & vbNewLine
Response.Write " <tr><td>Probation Status: </td><td>"
Response.Write "<input type=""radio"" name=""memberstat"" value=""0"" checked> NOT On Probation<br>"
Response.Write "<input type=""radio"" name=""memberstat"" value=""1""> ON Probation<br></td></tr>" & vbNewLine
Response.Write " <tr><td> </td><td>"
Response.Write "<input type=""submit"" name=""Submit"" value=""Set Probation Status""></td></tr>" & vbNewLine
Response.Write " </table>" & vbNewLine
Response.Write "</form>" & vbNewLine
WriteFooter
Response.End
%>
Edited to give GauravBhabu credit for his User Moderation Mod |
--Jördan It's a wasted day if you don't spend at least part of it flying upside down. |
Edited by - jfitz on 30 April 2003 22:50:51 |
|
laser
Advanced Member
Australia
3859 Posts |
Posted - 01 May 2003 : 01:06:46
|
Thanks for that jfitz I will be implementing it tonight, seems like a very simple 5 minute fix. |
|
|
volition
Starting Member
USA
49 Posts |
|
jfitz
Junior Member
USA
345 Posts |
Posted - 23 July 2003 : 23:35:49
|
Glad it works for you. You don't need it often, but it's nice to have it. An quick admin page to display all the on-probation members would be an nice additional feature. I'm working on a change to members.asp that would allow you to set the probation status from there, similar to locking or deleting a registration. Shouldn't be too difficult, but time is rather short these days. |
--Jördan It's a wasted day if you don't spend at least part of it flying upside down. |
|
|
volition
Starting Member
USA
49 Posts |
Posted - 22 September 2003 : 05:54:53
|
Additional Code Changes:
Unmoderated Posts are visible on reply page if you do not do this:
post.asp
find:
if (mLev = 4) or (chkForumModerator(strRqForumId, strDBNTUserName) = "1") then
Moderation = "N"
else
if strModeration = 1 and rsa("CAT_MODERATION") = 1 and (rsa("F_MODERATION") = 1 or rsa("F_MODERATION") = 3) then
Moderation = "Y"
else
Moderation = "N"
end if
end if
and change it to
if (mLev = 4) or (chkForumModerator(strRqForumId, strDBNTUserName) = "1") then
Moderation = "N"
else
Moderation = "Y"
end if |
Volition® - The Net's Oldest Free-Stuff Site Snitz Forum at http://forum.volition.com/ |
Edited by - volition on 22 September 2003 05:57:16 |
|
|
terre
Starting Member
18 Posts |
Posted - 01 October 2003 : 23:09:36
|
I'm having a problem with this mod -- for some reason all the moderated posts are visible to everyone on the topic.asp page, not just the moderators and admins.
I also have the topic set to be moderated, but that only makes everyone moderated, not just the person who has been put on user probation with this mod. So even with this mod, I can't choose who is to be put on probation - it's either everyone or no one. What setting have I missed?
|
Edited by - terre on 02 October 2003 00:12:38 |
|
|
terre
Starting Member
18 Posts |
Posted - 02 October 2003 : 18:38:16
|
Has anyone used this mod, as is, successfully? I have had to go into the topic.asp and forum.asp pages and make changes because the 'moderated' topics and posts were showing up for everyone. (I don't have any other user level mods installed and maybe that was the problem?)
Would really appreciate any help so that I know I've covered everything.
|
|
|
jfitz
Junior Member
USA
345 Posts |
Posted - 06 October 2003 : 22:23:25
|
quote: Originally posted by terre
I'm having a problem with this mod -- for some reason all the moderated posts are visible to everyone on the topic.asp page, not just the moderators and admins.
I haven't noticed this problem before...can you describe it a bit more fully. Sorry about the delay in replying, but I've been off-line until today because of hurricane Isabel.
quote: Originally posted by terre
I also have the topic set to be moderated, but that only makes everyone moderated, not just the person who has been put on user probation with this mod. So even with this mod, I can't choose who is to be put on probation - it's either everyone or no one. What setting have I missed?
I'm not sure I fully understand this question. Can you elaborate? Thanks.
|
--Jördan It's a wasted day if you don't spend at least part of it flying upside down. |
|
|
terre
Starting Member
18 Posts |
Posted - 10 October 2003 : 05:15:20
|
I have the mod working now but it involved making changes to the forum.asp and topic.asp pages or otherwise the pending messages would show. Those pages check the status of the forum for moderation level and if the forum doesn't have any moderation set then it ignores the settings on the ind posts, right? I made changes so that the script would check the ind. post status regardless of whether the forum was moderated or not. Does this make sense? |
Edited by - terre on 10 October 2003 05:16:17 |
|
|
jfitz
Junior Member
USA
345 Posts |
Posted - 10 October 2003 : 15:01:15
|
I see what you are talking about. I normally use "Quick Reply" so I wouldn't have noticed that problem. I just checked it out with a couple of non-admin, non-moderator test accounts, and yes, you are correct...the non-moderated post does show in the list of replies when replying to a topic.
I think this oversight will also apply to the User Level Moderation Mod, but I haven't checked that out yet to be sure. Checking the individual post status is the only definitive way that I see to correct this behavior. Can you post the additional changes that you made so that I can incorporate them into the mod?
Thanks!
|
--Jördan It's a wasted day if you don't spend at least part of it flying upside down. |
|
|
terre
Starting Member
18 Posts |
Posted - 10 October 2003 : 23:53:43
|
Disclaimer: I am not an expert, but here is what I did and it is working. Let me know if there is a problem or concern with doing it this way.
forum.asp around line 224 I commented the if/end if (in red) so that it always assumed moderation.
' commented this so as not to show unmoderated folders on forum.asp '##### user probation mod 'if strModeration = 1 and Cat_Moderation = 1 and (Forum_Moderation = 1 or Forum_Moderation = 2) then Moderation = "Y" 'end if ' DEM --> End of Code added for Moderation
around line 262
' DEM --> if not a Moderator, all unapproved posts should not be viewed. if AdminAllowed = 0 then strSql3 = strSql3 & " AND ((T.T_AUTHOR <> " & MemberID strSql3 = strSql3 & " AND T.T_STATUS < " ' Ignore unapproved/rejected posts 'mine added moderation = "N" to keep from showing on forum.asp '#### user probation mod if Moderation = "Y" or Moderation = "N" then strSql3 = strSql3 & "2" ' Ignore unapproved posts
topic.asp around line 216
' DEM --> if not a Moderator, all unapproved posts should not be viewed. if AdminAllowed = 0 then strSql3 = strSql3 & "AND (R_STATUS < " 'mine added moderation = "N" to keep from showing on topic.asp - seems to work '#### user probation mod if Moderation = "Y" or Moderation = "N" then ' Ignore unapproved/rejected posts
around line 309 commented out original and added modified line
'mine added so as not to show when the specific topicID is used on topic.asp '##### user probation mod ' if (Moderation = "Y" and Topic_Status > 1 and Topic_Author <> MemberID and AdminAllowed <> 1 ) then if (Moderation = "Y" and Topic_Status > 1 and Topic_Author <> MemberID and AdminAllowed <> 1 ) or (Topic_Status > 1 and Topic_Author <> MemberID and AdminAllowed <> 1 ) then Response.write "<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """><br />Viewing of this Topic is not permitted until it has been moderated.<br />Please try again later</font></p>" & vbNewLine & _ "<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """><a href=""JavaScript:history.go(-1)"">Go Back</a></font></p><br />" & vbNewLine WriteFooter Response.end
around line 335
' DEM --> if not a Moderator, all unapproved posts should not be viewed. if AdminAllowed = 0 then strSql3 = strSql3 & " AND (R.R_STATUS < " 'mine added moderation = "N" to keep from showing on topic.asp - seems to work '#### user probation mod if Moderation = "Y" or Moderation = "N" then ' Ignore unapproved/rejected posts
|
Edited by - terre on 11 October 2003 00:04:37 |
|
|
jfitz
Junior Member
USA
345 Posts |
Posted - 11 October 2003 : 00:11:18
|
Thanks. I'll check out my code and see what our differences are. |
--Jördan It's a wasted day if you don't spend at least part of it flying upside down. |
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 13 February 2004 : 03:40:08
|
did you work this out? Also, what should I do to make all new users be "on probation" so that I have to approve their posts? |
/Tribaliztic - www.gotlandrace.se -
|
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 23 February 2004 : 14:55:01
|
Solved the above! After I changed hosts everything worked as it should.. |
/Tribaliztic - www.gotlandrace.se -
|
|
|
mortioli
Average Member
United Kingdom
898 Posts |
Posted - 21 April 2004 : 02:36:51
|
Is there anyway of creating this so all new members are on probation until they reach 50 posts? |
|
|
mortioli
Average Member
United Kingdom
898 Posts |
|
|
Topic |
|