Forum Index   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
wickedOffline



Joined: Oct 27, 2004
Posts: 11

Status: Offline
Post   Posted: Jul 26, 2005 - 02:16 PM Reply with quote Back to top

I've added a new field in the users table: $birthday

Code:
`pn_birthday` varchar(25) NOT NULL default ''


$birthday = pnUserGetVar('birthday');
$now = date();
$years_old = $now - $birthday;
$years_old = date("y", $years_old);

I try to don't show the news under the topic "sex" ($tid == "2") to the users that their age < 18 and show an error message if they try to see it, but i don't know what i have to do... LOST...

Any idea?? Sad Sad Sad

Sorry for my english Exclamation
View user's profile Send private message
Chestnut
Site Admin


Joined: Oct 08, 2003
Posts: 1065
Location: Paris - France
Post   Posted: Jul 26, 2005 - 03:12 PM Reply with quote Back to top

mmm...

Could take a little more than that.

Best way possible is to add the kiddos into a group (you must know there are under 1Cool, then simply add a permission for them not to see the specific topic.

_________________
Chestnut ! Cool
Administrator
PNConcept.com
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
wickedOffline



Joined: Oct 27, 2004
Posts: 11

Status: Offline
Post   Posted: Jul 26, 2005 - 08:55 PM Reply with quote Back to top

umMMMm, it's a great idea, very simple and nice Smile

But works with dates is a beat complicated for me Sad I would do a sql for insert those users wich $now - $birthday (date in years) will be < 18 and delete them when this sustraction be > 18 Sad

I repeat: sorry for my bad english Sad
View user's profile Send private message
Chestnut
Site Admin


Joined: Oct 08, 2003
Posts: 1065
Location: Paris - France
Post   Posted: Jul 26, 2005 - 11:25 PM Reply with quote Back to top

First, I'm not sure you pn_birthday field can work that way...

You should create a dynamic field instead as to not break the DB for future updates.

Secondlyn unless you are filling the birthday field yourself, from what I can see, you are assuming that they are filling their birthday in a timestamp format wich I doubt anyone can....... unless some autist able to count the number of seconds since 1970..... Wink

One of way that could work is to make 3 dyna fields
_BIRTHDAY
_BIRTHMONTH
_BIRTHYEAR

That way, it'll be a breeze to combine them using the mktime function ( http://www.php.net/mktime )

Then, you'll be able to do easily a $now - mktime(0,0,0, $month, $day, $year) to know if he has more or less than 18.

Something like that.

_________________
Chestnut ! Cool
Administrator
PNConcept.com
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
wickedOffline



Joined: Oct 27, 2004
Posts: 11

Status: Offline
Post   Posted: Jul 26, 2005 - 11:36 PM Reply with quote Back to top

I understand... but... my big problem is the same...

Thanks for all Chestnut, keep up the good work!
View user's profile Send private message
Chestnut
Site Admin


Joined: Oct 08, 2003
Posts: 1065
Location: Paris - France
Post   Posted: Jul 26, 2005 - 11:54 PM Reply with quote Back to top

mmm The future uses of hooks within PostNuke will make our lives so much simpler, you can't imagine.

I know what I mean... Laughing

Wink

_________________
Chestnut ! Cool
Administrator
PNConcept.com
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Chestnut
Site Admin


Joined: Oct 08, 2003
Posts: 1065
Location: Paris - France
Post   Posted: Jul 27, 2005 - 12:00 AM Reply with quote Back to top

wicked wrote:
I understand... but... my big problem is the same...


Wich is ? If building the thing it is, then I admit that I don't have any automated way I'm afraid and building it might need a little reflexion...

The sql and all...

Not necessarily hard... but still...

1 Getting all your users
2 Building the birthtime from their info

3 Moving through your result and if > 18, removing from non-priviledged group else... adding them...

But it quite manual.

_________________
Chestnut ! Cool
Administrator
PNConcept.com
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits
DarkMindZ