Age & Gender Board Filter Mod

Started by Eliana Tamerin, June 20, 2008, 03:25:15 AM

Previous topic - Next topic

Eliana Tamerin

Link to Mod

AGE & GENDER BOARD FILTER MOD
By Eliana Tamerin || Originally by Senkusha


This mod is written for 1.1.5. It may work on older versions (no guarantee), but it will not work on any 2.0 versions. An upgrade to 2.0 is not yet planned.

Warning
Installing any modification is a risk to your forum. Please backup BOTH your database (structure and data) and files before attempting to install. You have been warned.

Known Conflicts

Introduction
Restrict entrance into a specific board by profile-set age or gender. Users are restricted from editing their age and gender after it has been set (only admins can after that). Ages over 80 default to 0 for the purposes of this mod.

Also, please note that this mod will restrict guests from entering the boards you modify with the age/gender options. This also means that seach engines will not be able to access these boards.

How To Use This Mod
-Install the mod
-Navigate to Admin CP > Boards > (Board you wish to modify) "Modify"
-Enter minimum age and maximum age or select gender you wish to restrict
-Click "Modify"
-Users are now allowed into/restricted from the board you just modified based on their minimum age, maximum age or gender

-To require the gender and/or birthdate fields on the registration page:
--Navigate to Admin CP > Registration > Settings
--Check/uncheck the options at the bottom
--Save

Regarding Upgrades
When the mod version is upgraded, I will try to provide upgrade packages for earlier versions. However, because the number of supported versions may become overly strenuous, I will only guarantee upgrade scripts for the past two versions of the mod. I will keep the changelog accurate to make it easy to figure out whether you have a version within that timeframe or not. If an upgrade script is not available, you must uninstall the mod prior to installing the newest version. You may need to update each board's settings after doing this.

Notes
This is the first mod of Eliana Tamerin, taken over from another coder. Please keep that in mind as you request features or ask for support. However, feature requests/suggestions and support requests are always welcome. Patience is advised.

Changelog
0.1.0 - August, 2006
o Initial Release by Senkusha
0.1.0 - September, 2007
o Mod is updated for 1.1.3 by JohnyB
1.0 - June 17, 2008
o Taken over by Eliana Tamerin
o Mod is updated to 1.1.5.
o Mod is brought up to SMF Coding Standards and submitted to mod site
1.0.2 - June 17, 2008
o Fixed issues as required by SMF Customization Team
1.0.4 - June 17, 2008
o Fixed loopholes in ManageBoards and Profile to restrict age
1.1.0 - June 21, 2008
o Fixed misspelling in language
o Added Maximum Age to view board option
1.1.1 - June 26, 2008
o Added upgrade option to installer
1.2.0 - July 13, 2008
o Fixed bug that didn't allow users who haven't set their birthdates to enter unrestricted forums (unrestricted by age)
o Added registration field for gender (code borrowed with permission from GenderonRegistration mod)
o Added registration field for birthdate
o Added settings in ADMIN CP > REGISTRATION > SETTINGS to require gender and/or birthdate on registration page
1.2.1 - July 23, 2008
o Fixed bug on registration page related to requiring the gender field. (Thanks to [SiNaN]
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

[SiNaN]

Glad to see it approved. Good luck with it Eliana. ;)

Former SMF Core Developer | My Mods | SimplePortal

N3RVE

Ralph "[n3rve]" Otowo
Former Marketing Co-ordinator, Simple Machines.
ralph [at] simplemachines [dot] org                       
Quote"Somewhere, something incredible is waiting to be known." - Carl Sagan

Alpay

I need that modifications on my some sites . Thats taking time , doing it manual thank you for that. But i read your plans for 2.0 if it can be earlier it would be better.

Eliana Tamerin

I basically just put that so I wouldn't get 200 people asking me for a 2.0 version or when it would be out. I'm sticking to what's there, but I won't say that a 2.0 version will never happen. It's just not planned at the moment (primarily because Beta4 is going to introduce a lot of bug fixes, and that means code fixes, so I'd just have to start over again).
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

Cal O'Shaw

Hello,

Looks interesting and I'm going to consult with my Admin Team about implementing it.  And if I understand correctly, guests won't be able to look at any boards with age restrictions because guests can't say how old they are, yes?

Very minor nit... the text string about setting the minimum age has the word "minimum" misspelt ;).

Thank you for making it available.

Cal

Eliana Tamerin

Thanks for the interest, Cal.

To answer your question, guests will not be able to see any boards you set age or gender requirements on (because guests have no profile information so they can't set their age or gender). Nor will spiders, so if you're concerned about getting those forums indexed by search engines, then don't restrict them.

And thank you for pointing out the misspelling, I'll chalk it up for a fix for the next version.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

NEMINI

is there an option to force the restrictions to apply to mods/admins also?
signatures are boring.

Eliana Tamerin

Well, that sort of defeats the point of being an admin. Admins have "god" powers over the entire forum, so restricting them would contradict that.

I can probably put in an option for it, but why? You won't be able to see the specific boards there either, then, if you're an admin.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

Lady Night Owl

Nice mod and would be useful for my forum, but I'm getting this at the top:

Quote// Start Age and Gender Filter Mod $txt['min_age_title'] = 'Minimum Age to View Board:'; $txt['min_age_desc'] = 'What is the mimiumn age for viewing access for this board?'; $txt['gender_title'] = 'Gender Restricted (only):'; $txt['gender_desc'] = 'Which gender is this board restricted to view / post?'; $txt['gender_block_disabled'] = 'Unrestricted'; $txt['gender_block_gender_set'] = 'Unknown Genders Only'; $txt['gender_block_girls'] = 'Male Only'; $txt['gender_block_boys'] = 'Female Only'; $txt['gender_block_gender_unset'] = 'Male and Female Only'; // End Age and Gender Filter Mod

What do I need to change to make this go away?
Running SMF 2.0.1

Eliana Tamerin

Your language file didn't edit properly. Open your /Themes/default/languages/modifications.english(whatever else it is, might be utf8 or british, etc).php and move the ?> to the bottom of the file. Save and reupload.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

Lady Night Owl

Running SMF 2.0.1

Eliana Tamerin

Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

NEMINI

Quote from: Eliana Tamerin on June 21, 2008, 10:53:46 AM
Well, that sort of defeats the point of being an admin. Admins have "god" powers over the entire forum, so restricting them would contradict that.

I can probably put in an option for it, but why? You won't be able to see the specific boards there either, then, if you're an admin.

I have both male and female admins so not seeing it wouldn't be an issue.  However in my case I would like to make two boards.  One 'The Boy's Room' and one 'Girl's Only'.  They wouldn't be truely one sex or the other if admins could constantly peek in and see what the other sex was saying.  I want a place for each sex to be comfortable talking amoungst themselves without feeling like whatever they say could be seen by the other sex.
signatures are boring.

Eliana Tamerin

Well, in Load.php, this is the code you'd have to edit:
if (!$user_info['is_admin'])
{
$user_info['query_see_board'] .= ' && b.MinAge <= ' . (int) $age;
// Add condition for Unrestricted Genders, then qualify based on 0 (Unset Gender), 1 (Males), 2 (Females), 3 (Boys OR Girls, no UNSET genders!)
$user_info['query_see_board'] .= ' && ((b.gender_sel = -1 || b.gender_sel = ' . $memberGenderType . ') || (b.gender_sel = 3 && ' . $memberGenderType . ' > 0))';
}


If the conditional is removed, then it applies to admins as well as members. Something like:

$user_info['query_see_board'] .= ' && b.MinAge <= ' . (int) $age;
// Add condition for Unrestricted Genders, then qualify based on 0 (Unset Gender), 1 (Males), 2 (Females), 3 (Boys OR Girls, no UNSET genders!)
$user_info['query_see_board'] .= ' && ((b.gender_sel = -1 || b.gender_sel = ' . $memberGenderType . ') || (b.gender_sel = 3 && ' . $memberGenderType . ' > 0))';
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

Eliana Tamerin

I'm currently working on version 1.1, which will fix a few bugs and include a new feature: "Maximum Age to enter board" (so now you can restrict to a certain agegroup).

Just working out the last few little bugs and kinks, especially with the install/upgrade/uninstallation. I don't want to force you guys to uninstall, because it does go a bit screwy, and I'm trying to figure out a resolution to that.

BTW, if you have uninstalled and your members can't see your forums, just modify them and save without changing any info. That should work.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

digit

Cool! ...  if I install this....  how would I do this? (in index.template.php)

...  if age is under 14 ...

don't echo ' <a href="here.html">some link</a>';

or, would there be a simpler way of me of just doing that?  :p

This seems like a VERY useful mod - and I am anxious to give it a try!

Thanks!
Happily using a heavily modified 1.1.16 version of SMF!

2748011 Posts in 320998 Topics by 50986 Members


SOLD my website - thanks it was a good run - they converted to vbadvanced. (and screwed it up good!)

Eliana Tamerin

Read the "How to use this mod" part of the first post. It's much simpler than that.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

MaXiForum.cz

#18
It´s a perfekt mod :)

Czech translation:
./Themes/default/languages/Modifications.czech.php

// Start Age and Gender Filter Mod
$txt['min_age_title'] = 'Minimální věk pro zobrazení fóra:';
$txt['min_age_desc'] = '(napiste číslicí minimální věk)';
$txt['gender_title'] = 'Povolení dle pohlaví:';
$txt['gender_desc'] = '(vyberte jednu z možností)';
$txt['gender_block_disabled'] = 'Neomezeno';
$txt['gender_block_gender_set'] = 'Nezjištěno';
$txt['gender_block_girls'] = 'Jen muži';
$txt['gender_block_boys'] = 'Jen ženy';
$txt['gender_block_gender_unset'] = 'Muži i ženy';
// End Age and Gender Filter Mod

Eliana Tamerin

Thanks for using my mod, MaxiPes.

For 1.1, I'm adding in two more language strings:

$txt['min_age_zero'] = '(0 to disable)';
$txt['max_age_eighty'] = '(80 to disable)';


I'd love to include the Czech language, but I don't want it to be incomplete.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

Advertisement: