PDA

View Full Version : Age Locked Forums


stuie_b
08-01-2005, 10:00 PM
Ok this is my first hack and since i dont want to make people angre a posted it in here

Provent unauthorized access ot a forum by an underaged user, Age Limit Will provent anyone
who isn't old enough to view the forum while allows those who are.

Features
+ Admins/mods are excempt from age limitation
+ User Defined age and forum to lock
+ Prevents access to post files aswell as forum
+ Removes Birthday date changing via profile (now only admin can change it)
+ Provents Searching to access posts
+ Provents Guest viewing of locked forums while other forums are open to guests
+ Provents Accessing thread/posts directly
+ Provents Access by using Forum Jump
+ Checks Age by using all D.O.B values


Thanks to KirbyDE for optimizations, sketch42 for bug testing, nexialys for bug testing


Version History
--- 0.2
-- Added Template edit thanks to sketch42
-- Changed method of age checking to check the day and month
--- 0.1E
-- Fixed Installer typo
-- Removed image relations in install.html
--- 0.1D
-- Optimized code thanks to KirbyDE


Please let me know what you all think

stuie_b :ermm:

Andreas
08-02-2005, 12:14 PM
Optimization suggestion

function check_age($userid,$forumid)
{
global $forumcache;
$userinfo = fetch_userinfo($userid);
$now = date('d-m-Y');
$bday = explode("-", $userinfo['birthday']);
$now = explode("-", $now);
$j = $now[2] - $bday[2];
return (int)($j >= $forumcache["$forumid"]['age_value']);
}


function check_lock($forumid)
{
global $forumcache;
return $forumcache["forumid"]['age_locked'];
}


Furthermore, you could remove the Locked Yes/No setting and define 0 being unlocked, would save memory.
And your age-check does only check the Year, should also check month/day.

stuie_b
08-02-2005, 01:17 PM
Thanks alot KirbyDE i've updated the code with your suggests, The check is still performed on the year for now but all other suggests were applied

thanks again

stuie_b

nexialys
08-02-2005, 01:35 PM
in your install file, there is a typo:$DB_site->query("ALTER TABLE forum ADD age_value? varchar(10) DEFAULT ''"); just after age_value ...

and for your install.html, please don't add anything related to your own website... the actual style, icons and images are linked to your site, and will give you too much trafic and too much lag if your site is down one day...

stuie_b
08-02-2005, 02:19 PM
thanks nexialys for the heads up on the installer typo fixed

thanks

stuie_b

sketch42
08-02-2005, 02:26 PM
will this remove the birthday from the public profile as well?

stuie_b
08-02-2005, 02:27 PM
no the birthday will still be displayed in the public profile

stuie_b

sketch42
08-02-2005, 02:28 PM
the reason i asked is because i want to change this ..
If you enter your birth date using the controls provided here, other forum visitors will be able to see your birthday on the forum calendar and in your profile. Adding your year of birth is optional.
this is what it shows during registration, and i wanted to word it in a way where it would discourage users from inputing a fake birthday from the start

sketch42
08-02-2005, 02:40 PM
k i found where it is in MEMBERINFO template

just find this

<div class="fieldset">
<if condition="$show['extrainfo']">
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
<if condition="$userinfo['birthday']">
<tr>
<td>
<strong>$vbphrase[birthday]</strong>:<br />
$userinfo[birthday]
</td>
</tr>
</if>
$customfields
</table>
<else />

and change it to this

<div class="fieldset">
<if condition="$show['extrainfo']">
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">

$customfields
</table>
<else />

in case anyone else wants to do this

and than just edit that phrase

stuie_b
08-02-2005, 03:02 PM
Fixed the check procedure now checks against all three values, day month and year and added template edit thanks sketch42

stuie_b

Boofo
08-02-2005, 03:24 PM
Great! Now when do we get the 3.5 upgrade? ;)

sketch42
08-02-2005, 03:31 PM
i never did like those html install texts..

all the lines where all screwed up and i kept getting parse errors all over
i rechecked everything and aparently it doesnt copy paste well at all
so here is a zipped txt file for the install


this is of the 0.2vers

edit ***

here it is


EDIT*** new version fixed my parse error :o

Boofo
08-02-2005, 03:34 PM
i never did like those html install texts..

all the lines where all screwed up and i kept getting parse errors all over
i rechecked everything and aparently it doesnt copy paste well at all
so here is a zipped txt file for the install


this is of the 0.2vers

Where is it? ;)

sketch42
08-02-2005, 03:36 PM
Where is it? ;)

right there :lick:

Boofo
08-02-2005, 03:37 PM
But I need the 3.5 RC 1 version. :(

Boofo
08-02-2005, 03:58 PM
i never did like those html install texts..

all the lines where all screwed up and i kept getting parse errors all over
i rechecked everything and aparently it doesnt copy paste well at all
so here is a zipped txt file for the install


this is of the 0.2vers

edit ***

here it is

Will this work on 3.5 RC1?

(I KNEW it wasn't going blind. ;))

sketch42
08-02-2005, 03:59 PM
ok im still getting a parse error

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/xxxxxx/public_html/admncp/forum.php on line 83

stuie_b
08-02-2005, 04:33 PM
make sure that you place a , at the end of 'showonforumjump' => 1

stuie

sketch42
08-02-2005, 04:56 PM
edit

found it

sketch42
08-02-2005, 05:05 PM
works beautiful... updated the txt install with the comma that i missed

one last thing as of right now the users can still see the forum but can not enter
is it possible to make the forum invisible?

stuie_b
08-02-2005, 05:07 PM
am going to add that feature to the next version :)


thanks for all your help


cheers

stuie

sketch42
08-02-2005, 05:14 PM
no prob.. i really wanted this and started looking into it .. im glad you made it though Excellent job !!!

sketch42
08-04-2005, 02:48 AM
ok i dont know if its only me.. but im gonna uninstall the hack just to make sure.. guests now get you are not logged in error message when they try to view any forum
even if not age locked.. can someone confirm this?

sketch42
08-04-2005, 02:55 AM
yes just uploaded all my original files and everything is working fine now..

the thing is i wouldnt have minded if it only showed that to guests who wanted to view the forum i age locked but it did it to every forum on the board.

i really like this hack and would like to see it out of beta stage

stuie_b
08-04-2005, 08:23 AM
sketch42 i found the problem with guests and fixed it if not done so download the edits again and try that

stuie

sketch42
08-04-2005, 09:11 AM
just redo the edits? or should i run the install again?

sketch42
08-04-2005, 09:55 AM
yup that worked

/me is very happy with this hack
/me thinks it should be standard

DjTaz
01-12-2006, 09:17 PM
Stuie - Before i install this i want to ask - what about people who dont have the YEAR of birth installed ?

I have a lot of members who never put in their year or birth , and they can still do this in the registration ... what happens if they dont enter a year ? - and is there an option for them to add it in if i install this . or will they have to contact me ?

stuie_b
01-15-2006, 10:02 AM
it's really intended for a new install but a supose you could just get your users to enter there details before you install this mod.

stuie b

murdo
09-07-2006, 08:53 AM
Will this work with vB 3.6.0?

DJRavine
09-11-2007, 05:20 PM
i highly doubt anyone will reply to this.. but i am receiving this error..
just wondering if i could get pointed in the right direction...

this error appears while i am trying to save the forums options via forum manager on the admincp...

(vBulletin 3.6.7 PL1)

Fatal error: Field age_locked is not defined in $validfields in class vb_datamanager_forum in /includes/class_dm.php on line 485