Advertisement:

Author Topic: Age & Gender Board Filter Mod  (Read 66503 times)

Offline Eliana Tamerin

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,611
  • Gender: Female
Re: Age & Gender Board Filter Mod
« Reply #20 on: June 26, 2008, 12:42:06 PM »
Alright, I've fixed the issue I was having with the upgrader. Version 1.1 is now Released!

Version 1.1 features:
  • Bug fix for age restriction on profile
  • Added feature: Maximum Age to Restrict

    I highly recommend upgrading to 1.1, as the bug in 1.0 prevented everybody from editing the age in their profiles, regardless of whether it was previously set or not.

    You may use the package as an upgrade script. To do so, do not uninstall 1.0.4, but download the 1.1 package and upload to your package manager like a normal mod. Then install like normal, and it will work.
Do NOT PM me for support.

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

Offline [SiNaN]

  • SMF Super Hero
  • *******
  • Posts: 11,526
  • Young and Foolish
    • SimplePortal
Re: Age & Gender Board Filter Mod
« Reply #21 on: June 26, 2008, 01:05:46 PM »
You're so fast. Thanks for the update Eliana. ;)
Former SMF Core Developer | My Mods | SimplePortal

Offline Sakae

  • Full Member
  • ***
  • Posts: 498
  • Gender: Male
    • TigreLOG
Re: Age & Gender Board Filter Mod
« Reply #22 on: June 27, 2008, 12:20:18 AM »
Thank you very much, Eliana.

I used this mod a "few versions ago" (lol), but it didn't worked with 1.1.5. Now it does!

That's a great find to "adult boards" and other stuff... lol
http://www.tigrelog.com.br
l: simple p: machines

Offline Eliana Tamerin

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,611
  • Gender: Female
Re: Age & Gender Board Filter Mod
« Reply #23 on: June 27, 2008, 01:21:38 AM »
Thanks for using the mod, and for your kind words, softcore.
Do NOT PM me for support.

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

Offline djrem

  • Semi-Newbie
  • *
  • Posts: 90
Re: Age & Gender Board Filter Mod
« Reply #24 on: June 27, 2008, 10:54:17 AM »
Excellent Mod

Just incase anyone asks, on my forum i had this scenario:

Boards disappeared to users.

This was rectified simply by editing each board and clicking modify to save it.

The board would then appear.

Everything works perfectly.

Installed on: www.voguefm.co.uk

A happy customer :)

Offline Lady Night Owl

  • Jr. Member
  • **
  • Posts: 133
  • Gender: Female
Re: Age & Gender Board Filter Mod
« Reply #25 on: June 27, 2008, 12:26:43 PM »
I love this mod, thank you Eliana!

One thing I would like to suggest for a future release is that the date of birth be required on the registration form (if possible), not just a check box that says "I am at least [##] years old".

Of course, I'm thinking that this would ideally tie into the user profile. For now, I've added a custom profile fields and forced this info to be entered.

Maybe that should be a separate mod... :-\
Running SMF 2.0.1

Offline Kat9119

  • Full Member
  • ***
  • Posts: 482
Re: Age & Gender Board Filter Mod
« Reply #26 on: July 01, 2008, 01:31:26 AM »
I would love to install this as I would like an adult forum, however I have a few questions first, and I know that the coder isn't around, so I'll just post it and wait for an answer ;)

1 - Does this have it so that all members are forced to update their age? Meaning, as soon as I installed this, perhaps there could be a message that states a member cannot use the forum without updating their birthday? That way all members have to answer it. If not is there a way to do it?

2 - Does this restrict mods who are underage? I have two moderators who are under 18 that I wouldn't want to get into the adult area.


Of course, I'm thinking that this would ideally tie into the user profile. For now, I've added a custom profile fields and forced this info to be entered.

Maybe that should be a separate mod... :-\

Isn't there already a way to force a user to enter a birthday when registering? If not, how did you get this Age Mod to work with your Custom Field for age, so that the Age Mod reads the Age Field?

Offline [SiNaN]

  • SMF Super Hero
  • *******
  • Posts: 11,526
  • Young and Foolish
    • SimplePortal
Re: Age & Gender Board Filter Mod
« Reply #27 on: July 01, 2008, 05:02:21 AM »
Have a good holiday Eliana. ;)

Let me try to give answer until Eliana is back.

1) Okay, let's force them.

Load.php

Find:

Code: [Select]
?>
Replace:

Code: [Select]
function checkAge()
{
global $ID_MEMBER, $context, $db_prefix;

if($context['user']['is_guest'])
return false;

$request = db_query("
SELECT birthdate
FROM {$db_prefix}members
WHERE ID_MEMBER = $ID_MEMBER
LIMIT 1", __FILE__, __LINE__);
list ($birthdate) = mysql_fetch_row($request);
mysql_free_result($request);

if((empty($birthdate) || $birthdate === '0001-01-01') && $context['current_action'] != 'profile' && $context['current_action'] != 'logout')
redirectexit('action=profile;u=' . $ID_MEMBER . ';sa=forumProfile');
elseif((empty($birthdate) || $birthdate === '0001-01-01') && $context['current_action'] == 'profile')
echo '<span style="color: red; font-weight: bold;">Please fill in your birtdate profile area.</span>';

}

?>

index.php

Find:

Code: [Select]
loadPermissions();
Replace:

Code: [Select]
loadPermissions();

// Did they select their age?
checkAge();

2) It restricts. Even if the user is a Global Moderator or the moderator of that board.

3) Let's force the users to enter their age while registering too.

Register.template.php

Find:

Code: [Select]
document.forms.creator.regSubmit.disabled = isEmptyText(document.forms.creator.user) || isEmptyText(document.forms.creator.email) || isEmptyText(document.forms.creator.passwrd1) || !document.forms.creator.regagree.checked;
Replace:

Code: [Select]
document.forms.creator.regSubmit.disabled = isEmptyText(document.forms.creator.user) || isEmptyText(document.forms.creator.email) || isEmptyText(document.forms.creator.passwrd1) || !document.forms.creator.regagree.checked || isEmptyText(document.forms.creator.bday1) || isEmptyText(document.forms.creator.bday2) || isEmptyText(document.forms.creator.bday3);
Find:

Code: [Select]
<input type="password" name="passwrd2" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr>';

Replace:

Code: [Select]
<input type="password" name="passwrd2" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr><tr>
<td width="40%">
<b>', $txt[563], ':</b>
<div class="smalltext">', $txt[566], ' - ', $txt[564], ' - ', $txt[565], '</div>
</td>
<td>
<input type="text" name="bday3" size="4" maxlength="4" value="" tabindex="', $context['tabindex']++, '" /> -
<input type="text" name="bday1" size="2" maxlength="2" value="" tabindex="', $context['tabindex']++, '" /> -
<input type="text" name="bday2" size="2" maxlength="2" value="" tabindex="', $context['tabindex']++, '" />
</td>
</tr>';

Register.php

Find:

Code: [Select]
loadLanguage('Login');
Replace:

Code: [Select]
loadLanguage('Login');
loadLanguage('Profile');
« Last Edit: July 02, 2008, 03:09:08 AM by [SiNaN] »
Former SMF Core Developer | My Mods | SimplePortal

Offline Lady Night Owl

  • Jr. Member
  • **
  • Posts: 133
  • Gender: Female
Re: Age & Gender Board Filter Mod
« Reply #28 on: July 01, 2008, 01:24:54 PM »
It works!!! Thank you SiNaN! You're brilliant! The only very very small glitch is the tab order - when you go to tab to the next field, it skips the birthday one altogether and goes right to CAPTCHA. Other than that, it's perfect.


Of course, I'm thinking that this would ideally tie into the user profile. For now, I've added a custom profile fields and forced this info to be entered.

Maybe that should be a separate mod... :-\

Isn't there already a way to force a user to enter a birthday when registering? If not, how did you get this Age Mod to work with your Custom Field for age, so that the Age Mod reads the Age Field?

As far as I know, you can only set the minimum age in the registration settings - but, it doesn't make a person enter their birthday, it only makes it so they have to check a box that says "I am at least {whatever age you specify} years old." If they don't check the box, their registration can be rejected.

This Age Mod doesn't work with the Custom Field mod as far as I know - what I did was create a custom text field requesting the date of birth, chose the option to make it a required field and set it so that only I (the admin) can view/edit it.

But, SiNaN has posted a fix for that so I deleted the custom field. Woo Hoo!
« Last Edit: July 01, 2008, 02:29:03 PM by ladynightowl »
Running SMF 2.0.1

Offline [SiNaN]

  • SMF Super Hero
  • *******
  • Posts: 11,526
  • Young and Foolish
    • SimplePortal
Re: Age & Gender Board Filter Mod
« Reply #29 on: July 02, 2008, 03:08:27 AM »
Ahh, sorry. Just forgot the tabindex. After you make the changes in the Register.template.php, do this:

Find:

Code: [Select]
<input type="password" name="passwrd2" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr><tr>
<td width="40%">
<b>', $txt[563], ':</b>
<div class="smalltext">', $txt[566], ' - ', $txt[564], ' - ', $txt[565], '</div>
</td>
<td>
<input type="text" name="bday3" size="4" maxlength="4" value="" /> -
<input type="text" name="bday1" size="2" maxlength="2" value="" /> -
<input type="text" name="bday2" size="2" maxlength="2" value="" />
</td>
</tr>';

Replace:

Code: [Select]
<input type="password" name="passwrd2" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr><tr>
<td width="40%">
<b>', $txt[563], ':</b>
<div class="smalltext">', $txt[566], ' - ', $txt[564], ' - ', $txt[565], '</div>
</td>
<td>
<input type="text" name="bday3" size="4" maxlength="4" value="" tabindex="', $context['tabindex']++, '" /> -
<input type="text" name="bday1" size="2" maxlength="2" value="" tabindex="', $context['tabindex']++, '" /> -
<input type="text" name="bday2" size="2" maxlength="2" value="" tabindex="', $context['tabindex']++, '" />
</td>
</tr>';

Fixed the message above too.

What about forcing the users to enter their age, have you tried that?
Former SMF Core Developer | My Mods | SimplePortal

Offline Eliana Tamerin

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,611
  • Gender: Female
Re: Age & Gender Board Filter Mod
« Reply #30 on: July 02, 2008, 02:03:36 PM »
I caught a wifi signal so I'm posting to say that I fully intend to include a registration field on the next version of the mod. I've also got permission from JayBachatero to use his GenderonRegistration mod code in mine. So 1.2 should have both registration fields included. And SiNaN, if you'll let me, I'll include that code to remind people to update their gender and birthday fields when the mod is installed.
Do NOT PM me for support.

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

Offline [SiNaN]

  • SMF Super Hero
  • *******
  • Posts: 11,526
  • Young and Foolish
    • SimplePortal
Re: Age & Gender Board Filter Mod
« Reply #31 on: July 02, 2008, 02:10:11 PM »
Of course Eliana. They are yours. ;) But you could make changes a bit cause I've -myself- found it annoying as you cannot do anything other then logging out until you define your birthday. :P
Former SMF Core Developer | My Mods | SimplePortal

Offline Kat9119

  • Full Member
  • ***
  • Posts: 482
Re: Age & Gender Board Filter Mod
« Reply #32 on: July 04, 2008, 04:11:41 PM »
oh, well, that stinks that it doesn't work with the Custom Profile Field mod, as I installed that a few days ago and users love it lol

Offline Eliana Tamerin

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,611
  • Gender: Female
Re: Age & Gender Board Filter Mod
« Reply #33 on: July 08, 2008, 04:55:10 PM »
I've been spending my last two days trying to code this properly, and I decided that I wanted to eliminate the need for setting the birthdate altogether (to allow people to retain the ability to set their birthday but not their birthyear). So I'm working on that, which is why there's no release now.

However, version 1.2 will have registration fields for gender and birthdate (neither required, unless I can't figure out the code I'm trying to write). I would like it also to feature a one-time reminder for setting birthdate & gender, if I can write that properly. We'll see.

Planned changes for 1.2:
  • Adding registration fields for gender and birthdate - Done
  • Adding reminder feature on installation to remind users to set their gender or birthdate in their profile - Moved to 1.3 version features
  • Allowing users who haven't set their birthdates to enter unrestricted forums (unrestricted by age) - Done
« Last Edit: July 13, 2008, 02:08:01 PM by Eliana Tamerin »
Do NOT PM me for support.

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

Offline Lady Night Owl

  • Jr. Member
  • **
  • Posts: 133
  • Gender: Female
Re: Age & Gender Board Filter Mod
« Reply #34 on: July 10, 2008, 09:13:45 PM »
I'm a little confused about the next version.

Please correct me if I'm wrong:

You're saying that you're making it so that the birth date isn't required at registration?

I'm not too concerned about the gender either way, but the birth date is another story. I just think it would be easier if the birth date (at least) was required upon registration.

Perhaps the code can be written to allow the admin to turn off whether this is a required field or not (ideally, this would probably be in the registration settings)? That's just an idea though.
Running SMF 2.0.1

Offline Eliana Tamerin

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,611
  • Gender: Female
Re: Age & Gender Board Filter Mod
« Reply #35 on: July 13, 2008, 12:20:12 PM »
I'm a little confused about the next version.

Please correct me if I'm wrong:

You're saying that you're making it so that the birth date isn't required at registration?

I'm not too concerned about the gender either way, but the birth date is another story. I just think it would be easier if the birth date (at least) was required upon registration.

Perhaps the code can be written to allow the admin to turn off whether this is a required field or not (ideally, this would probably be in the registration settings)? That's just an idea though.


I've added this as a feature in the next version. You can turn on/off the requirement in Admin CP > Registration > Settings.

Still working on the reminder. The thing I'm struggling over is whether to make a variable in the session, so the user is reminded only once-per-login, or whether to make it a field in the member table, so the user is reminded only once ever and then never again.

Anybody have any suggestions? If not, I may wind up making some configuration settings for it, because I can't decide myself.
« Last Edit: July 13, 2008, 12:22:26 PM by Eliana Tamerin »
Do NOT PM me for support.

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

Offline Lady Night Owl

  • Jr. Member
  • **
  • Posts: 133
  • Gender: Female
Re: Age & Gender Board Filter Mod
« Reply #36 on: July 13, 2008, 12:43:10 PM »
Phew! Thank you :D

I think you should go with making configuration settings for the reminder, that way the admins can decide and set it the way they want it according to their needs.
Running SMF 2.0.1

Offline Eliana Tamerin

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,611
  • Gender: Female
Re: Age & Gender Board Filter Mod
« Reply #37 on: July 13, 2008, 01:24:10 PM »
I've decided to push back the reminder feature to 1.3. It'll take a lot of work, and I want to get this version out to you guys. Since I fixed the bug related to the unset birthdate, forcing users to set their birthdate isn't a huge priority anymore. I'll include the reminder feature in version 1.3 for sure, though.

So the complete list of changes in 1.2 is as follows:
  • Adding registration fields for gender and birthdate
  • Adding option to require gender or birthdate fields on registration
  • Fixed bug that didn't allow users who haven't set their birthdates to enter unrestricted forums (unrestricted by age)

The new version will be up as soon as I figure out one last change, how to update the 1.1.1 version to 1.2.0 to fix the bug. Should be up sometime today.

EDIT: AGBF version 1.2.0 has been released. Thank you all for your patience and continued use of the mod. An upgrade package has been made available for both versions 1.0.4 and 1.1.1. This will be the last version where an upgrade from 1.0.4 will be supported, so I will leave 1.2 available for quite a while now. Version 1.3 will only support upgrades from 1.1.1 and 1.2.0.
« Last Edit: July 13, 2008, 02:20:16 PM by Eliana Tamerin »
Do NOT PM me for support.

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

bullbreedluverz

  • Guest
Re: Age & Gender Board Filter Mod
« Reply #38 on: July 13, 2008, 04:26:03 PM »
Hi, i tried to install this mod, from the link in your first post, on my SMF 1.1.5 and have experienced an error on the install;

2.     Execute Modification     ./Sources/Load.php     Test failed

are you able to shed any light on this please as to a possible rectification

Offline Eliana Tamerin

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,611
  • Gender: Female
Re: Age & Gender Board Filter Mod
« Reply #39 on: July 13, 2008, 04:30:35 PM »
It installs fine on a clean 1.1.5 version.

It's likely that you have another mod installed conflicting with the installation paths for my mod. Look at the instructions for modifying your file here: http://custom.simplemachines.org/mods/index.php?action=parse;mod=1260;attach=61142;smf_version=1.1.5

Try to use that to edit your Load.php. If you can't get it to work, attach your Load.php file to a post in here and I'll see what I can do.
Do NOT PM me for support.

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