Forum OpenACS Q&A: Demographic Information

Collapse
Posted by Ravi Gadad on
Is there a module in OpenACS that asks for demographic
information?  Where can I find it?  I can't seem to locate it in the
WWW directory.  I also have some questions about the
timestamp data type.. how do I insert a user-specified birthdate
into the users_demographics table under birthdate?  And
conversely, I need to find out a user's birthyear (just the four digit
year, i.e. 1975).. how do I pull that from the database?

My other very important question - how do I modify the data
model so that screen names are not null?  I want to use screen
names primarily, for logins and to distinguish users.  Do I need
to drop the users table and recreate it?  And if so, what's the
proper procedure to do a dump and then restore the data?

Thanks!

Collapse
Posted by Ben Adida on
Ravi, that's a lot of questions in one small paragraph! Let's see if I can address most of them.

- demographic information: it's there, but there isn't much code that will help you in inserting that information.

- As for inserting user-specified dates, you just specify dates in ANSI format, using something like '2000-09-22' as your value. If you want to use an automated widget, I suggest looking into the function "philg_dateentrywidget" and the corresponding "ns_dbformvalue" The first will help you display the date entry widget (look for it in tcl/ad-utilities) while the second will help you collect the three fields into one very easily (check aolserver.com/doc for precise instructions).

- getting the year out of a datetime/timestamp is easy using Postgres's to_char function, with something like "select to_char('YYYY', birthdate) from users"

- editing the users table: yes, you can do that, but be careful with such a modification. Make sure you really need to perform this action, because upgrading OpenACS will be come significantly more difficult.