| Author |
Message |
wicked
Joined: Oct 27, 2004
Posts: 11
Status: Offline
|
  Posted:
Jul 26, 2005 - 02:16 PM |
|
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??
Sorry for my english  |
|
|
|
 |
Chestnut
Site Admin
Joined: Oct 08, 2003
Posts: 1065
Location: Paris - France
|
  Posted:
Jul 26, 2005 - 03:12 PM |
|
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 1 , then simply add a permission for them not to see the specific topic. |
_________________ Chestnut !
Administrator
PNConcept.com |
|
 |
 |
wicked
Joined: Oct 27, 2004
Posts: 11
Status: Offline
|
  Posted:
Jul 26, 2005 - 08:55 PM |
|
umMMMm, it's a great idea, very simple and nice
But works with dates is a beat complicated for me 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
I repeat: sorry for my bad english  |
|
|
|
 |
Chestnut
Site Admin
Joined: Oct 08, 2003
Posts: 1065
Location: Paris - France
|
  Posted:
Jul 26, 2005 - 11:25 PM |
|
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.....
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 !
Administrator
PNConcept.com |
|
 |
 |
wicked
Joined: Oct 27, 2004
Posts: 11
Status: Offline
|
  Posted:
Jul 26, 2005 - 11:36 PM |
|
I understand... but... my big problem is the same...
Thanks for all Chestnut, keep up the good work! |
|
|
|
 |
Chestnut
Site Admin
Joined: Oct 08, 2003
Posts: 1065
Location: Paris - France
|
  Posted:
Jul 26, 2005 - 11:54 PM |
|
mmm The future uses of hooks within PostNuke will make our lives so much simpler, you can't imagine.
I know what I mean...
 |
_________________ Chestnut !
Administrator
PNConcept.com |
|
 |
 |
Chestnut
Site Admin
Joined: Oct 08, 2003
Posts: 1065
Location: Paris - France
|
  Posted:
Jul 27, 2005 - 12:00 AM |
|
| 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 !
Administrator
PNConcept.com |
|
 |
 |
|
|