Age Restriction Mod Idea

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/67002?pagenum=1
05 November 2025, 07:05

Topic


Carefree
Age Restriction Mod Idea
06 May 2008, 01:45


I would like a mod that allows different portions of the board to be automatically blocked from under-aged visitors/members. For example, one of the boards I visit occasionally has an adult humor section - and the mods have to review users by birthdate & manually modify the access lists to let people in after they become of age.
That is a bit more effort than I want to put into it. If we could use a check DOB string and if that particular section of the board had an age restriction in effect, the young'ns would be disallowed.<

 

Replies ...


Andy Humm
15 May 2008, 14:12


It should be possible, but some of our delightful 'yoofs' or 'minors', can easily submit a DOB that allows access permissions.<
MaD2ko0l
15 May 2008, 15:04


yes but, what if that forum was hidden from younger people they wouldnt know its there unless they initinally on registration supplied an adult age<
Carefree
15 May 2008, 15:24


Of course, but then we (as system operators) are covered, we've at least complied with the intent of the law.
I have an idea on how to write this, I'll start on it as soon as I finish the other two which I've promised.<
phy1729
15 May 2008, 17:46


Do you want the age limit to be in conjunction with another forum type or a separate forum type all together?<
Carefree
16 May 2008, 01:01


I want the age restriction to work throughout the forums, & either a toggle or a checkbox for the admins to control it within each forum or in a list like the forum order control page.<
Carefree
16 May 2008, 01:13


I thought of using the User Groups mod (but not really necessary), adding a global variable value, and then having it check along with the Moderator check.
Alternatively, could use User Groups & determine which forum categories should be off-limits, add them to a single group, & have the new user registration automatically place minors into a group that doesn't have access.<
phy1729
16 May 2008, 07:04


I would add another DB column to TOPICS that holds the minimum age perhaps called T_Min_Age. Did you have another way to approach this that you would prefer?<
Carefree
16 May 2008, 09:38


Let's not go all the way to topic level, age-restricting by forum is sufficient. I'd rather avoid the unnecessary labor of having to set age limits on each/every post. There's already a minimum age for registration, but it leaves a gap for the teen-aged minors (which I'd rather not fill by a visit to the Feds explaining why some sick pervert was using my board to reach teeny-boppers).<
MaD2ko0l
16 May 2008, 13:33


could you not add another moderation level for age?
maybe modify the forum posting restriction mod? (http://forum.snitz.com/forum/topic.asp?ARCHIVE=true&TOPIC_ID=6220) (download of the file can be located a few posts down from http://forum.snitz.com/forum/topic.asp?TOPIC_ID=66878&SearchTerms=mad2kool)


or maybe you coudl modify the User level moderation mod (found here http://forum.snitz.com/forum/topic.asp?ARCHIVE=true&TOPIC_ID=39014)

1 of these mods must be able to do what you need with a little bit of tweaking<
phy1729
16 May 2008, 18:00


Originally posted by Carefree
Let's not go all the way to topic level, age-restricting by forum is sufficient. I'd rather avoid the unnecessary labor of having to set age limits on each/every post. There's already a minimum age for registration, but it leaves a gap for the teen-aged minors (which I'd rather not fill by a visit to the Feds explaining why some sick pervert was using my board to reach teeny-boppers).
I meant FORUM oops. I'll have time next Thursday to work on it if you don't get there first.<
GarethMoore1979
16 May 2008, 18:10


haha.... your 72 years old- "your too old, get out!!!!" love it!<
Carefree
18 May 2008, 20:11


In the bottom of inc_func_member.asp, there are routines which calculate a member's age from DOB. They're tiny, so I'll include them.
Code:

Function DisplayUsersAge(fDOB)
dtDOB = fDOB
dtToday = FormatDateTime(strForumTimeAdjust,2)
DisplayUsersAge = DateDiff("yyyy", dtDOB, dtToday)
dtTmp = DateAdd("yyyy", DisplayUsersAge, dtDOB)
if (DateDiff("d", dtToday, dtTmp) > 0) then DisplayUsersAge = DisplayUsersAge - 1
End Function


function DOBToDate(fDOB)
'Testing for server format
if strComp(Month("04/05/2002"),"4") = 0 then
DOBToDate = cdate("" & Mid(fDOB, 5,2) & "/" & Mid(fDOB, 7,2) & "/" & Mid(fDOB, 1,4) & "")
else
DOBToDate = cdate("" & Mid(fDOB, 7,2) & "/" & Mid(fDOB, 5,2) & "/" & Mid(fDOB, 1,4) & "")
end if
end function

I have tried calling this function in several ways to get an age for comparison, but I get a variety of "you're so dumb" messages from my debugger. Would somebody who's used to this bit lend a hand?<
Carefree
25 May 2008, 08:10


Here's a routine I wrote for this purpose; it's not doing what I expect it to do, and I'll drive myself batty figuring out why.
Code:

'	############################# User Group Age Check Mod #############################
strSQL = "SELECT M_NAME, MEMBER_ID, M_DOB FROM " & strTablePrefix & "MEMBERS " & _
"WHERE MEMBER_ID = " & MemberID
set rsAdult = Server.CreateObject("ADODB.Recordset")
rsAdult.open strSql, my_Conn
if not rsAdult.EOF then
Member_DOB = rsAdult("M_DOB")
MMAge = DateDiff("yyyy", DOBToDate(Member_DOB), Date)
end if
rsAdult.close
set rsAdult = Nothing


strSql = "SELECT USERGROUP_ID FROM " & strTablePrefix & "USERGROUP_USERS " &_
"WHERE MEMBER_ID = " & MemberID
Set rsGroups = Server.CreateObject("ADODB.Recordset")
rsGroups.open strSql, my_Conn
rsGroups.close
set rsGroups = Nothing


if USERGROUP_ID = 8 then
if MMAge > 20 then
USERGROUP_ID = 7
MEMBER_TYPE = 1
strSql = "UPDATE " & strTablePrefix & "USERGROUP_USERS " &_
"(USERGROUP_ID, MEMBER_ID, MEMBER_TYPE) VALUES " &_
"WHERE MEMBER_ID = " & MemberID
set rsClr = Server.CreateObject("ADODB.Recordset")
rsClr.open strSql, my_Conn
rsClr.close
set rsClr = Nothing
end if
end if
' ############################# User Group Age Check Mod End #########################

Part 1 (in red) works. I've done an output to screen of MMAge and got what I needed.
Part 2 (in green) does not work. It doesn't retrieve the UserGroup_ID from the table. Thus, part 3 is never called and the process fails.<
cripto9t
25 May 2008, 12:08


I may be off the mark, but I think you're missing something.
Code:
strSql = "SELECT USERGROUP_ID FROM " & strTablePrefix & "USERGROUP_USERS " &_
"WHERE MEMBER_ID = " & MemberID
Set rsGroups = Server.CreateObject("ADODB.Recordset")
rsGroups.open strSql, my_Conn
if rsGroups.EOF or rsGroups.BOF then
'some error msg
else
USERGROUP_ID = rsGroups("USERGROUP_ID")
end if
rsGroups.close
set rsGroups = Nothing
<
Carefree
25 May 2008, 17:26


That fixed part 2, thanks. I had to rewrite part 3, but it now works. Now I have to rewrite the register.asp portion of automatically assigning people (minors) to the minor User Group and this will be done.<
Carefree
25 May 2008, 18:35


Maybe a fresh eye will help again.
Here's the routine for register.asp - after the else, it continues with adult auto-joining (if applicable):
Code:

    strSQL = "SELECT M_DOB FROM " & strTablePrefix & "MEMBERS_PENDING " & _
"WHERE M_NAME = '" & strNewMemberName & "'"
set rsAdult = Server.CreateObject("ADODB.Recordset")
rsAdult.open strSql, my_Conn
if not rsAdult.EOF then
Member_DOB = rsAdult("M_DOB")
MMAge = DateDiff("yyyy", DOBToDate(Member_DOB), Date)
end if
rsAdult.close
set rsAdult = Nothing
if MMAge < 21 then
USERGROUP_ID = 8
MEMBER_TYPE = 1
set rsClr = my_Conn.execute(strSql)
if not rsClr.BOF and not rsClr.EOF then
strSql = "INSERT INTO " & strTablePrefix & "USERGROUP_USERS " &_
"(USERGROUP_ID, MEMBER_ID, MEMBER_TYPE) VALUES "
myConn.execute(strSql)
end if
rsClr.close
set rsClr = Nothing
else

I'm not getting a value from the age check routine (in red), anyone see why?<
phy1729
25 May 2008, 21:19


Your using the wrong table. i.e. MEMBERS_PENDING not MEMBERS<
Carefree
25 May 2008, 21:22


Tried both, but until registration is complete, the member remains in the pending table (checked the DBase).<
phy1729
25 May 2008, 21:43


Pending members have nothing to do with this if I read the topic post correctly.
Also I forgot member tables have a diffrent prefix so it's
strMemberTablePrefix & "MEMBERS<
Carefree
25 May 2008, 22:20


You missed the fourth-to-last post. I'm modifying register.asp so that new members who are minors will automatically be assigned to a user group which precludes their having access to portions of the board. Thus it definitely does have to do with pending members.
As for strMemberTablePrefix, that isn't the issue; tried that.<
Carefree
25 May 2008, 23:31


I figured out a way in.

Code:

    strSQL = "SELECT MEMBER_ID, M_KEY, M_DOB FROM " & strMemberTablePrefix & "MEMBERS_PENDING " & _
" WHERE M_KEY = '" & key & "'"
set rsAdult = Server.CreateObject("ADODB.Recordset")
rsAdult.open strSql, my_Conn
if rsAdult.EOF or rsAdult.BOF then
'do nothing
else
MDOB = rsAdult("M_DOB")
MMAge = DateDiff("yyyy", DOBToDate(MDOB), Date)
end if
rsAdult.close
set rsAdult = Nothing

That populates the field. Now to see if the rest works.<
Carefree
26 May 2008, 00:32


Time to move this one. I'm through with it.
I put a copy on SnitzBitz.
Upon registration, minors (between your minimum age restriction and 21) will automatically be assigned to a minors' usergroup (which denies access to any "Adult" areas) that you create.
When the minor turns 21, they are automatically moved from the minors' usergroup to the members' usergroup and allowed access to those formerly restricted areas.<
© 2000-2021 Snitz™ Communications