Forum .LRN Q&A: how to add a new field in the registration page??? plz help

hi to all
can any one help in sorting out this problem:

how to add a new field (eg : Email,First name, last name .. etc .. i want to add another field like university name )(location : http://localhost/dotlrn/register/user-new ) in the registration page itself while the user register himself.i gone thru the code in the folder path...

/packages/acs-subsite/lib/

but couldnt find.

Thanks for any kind of suggestion.

Botherman

Dinesh

Hi Dinesh,

Take a look at the ad_form proc:

http://www.openacs.org/api-doc/proc-view?proc=ad%5fform

Takes some practice but it does most of the form handling in OpenACS and can show you how to add fields.

Cheers.

Dinesh,

to extend user registration fields, we use AMS package (Attribute Management System). See the AMS documentation "AMS lets developers (via tcl api) and site wide administrators (via the the ams admin UI) add attributes to acs_object"

The user bio is attribute sample of person object.

You can create many attributes you want without modifying the model of data.

How To:

1) Go to AMS instance and choose the object -PERSON
2) On UI create a new AMS Lists (a group name of "extend fields")
3)Create each Attribute you want. Choose name, Widget, etc.
4) Map Attributes to your new AMS Lists
5)To show the attributes on the registration form, edit the acs-subsite/lib/user-new.tcl

sample:

......
# Pre-generate user_id for double-click protection
set user_id [db_nextval acs_object_id_seq]

ad_form -name register -export {next_url user_id return_url} -form [auth::get_registration_form_elements]

++ ad_form -extend -name register -form [ams::ad_form::elements -package_key "acs-subsite" -object_type "person" -list_name "person_extra_info"]

if { [exists_and_not_null rel_group_id] } {
…..

5) now in the same archive modifies the on-sub action:

......
switch $creation_info(account_status) {
ok {
# Continue below
}
default {
# Display the message on a separate page
ad_returnredirect [export_vars -base "[subsite::get_element -element url]register/account-closed" { { message $creation_info(account_message) } }]
ad_script_abort
}
}

++ ams::ad_form::save \
++ -package_key "acs-subsite" \
++ -object_type "person" \
++ -list_name "person_extra_info" \
++ -form_name "register" \
++ -object_id $user_id

} -after_submit {
.......

6) in similar way modifies other archives to display/edit aditional attributes

This is actually something which should make it into core for 5.4. Once it is approved, we could add this AMS list to contacts as the default person form (at the moment there is a default person form per contacts instance, maybe we could change this to a default person form in AMS per subsite).
Isn't there already a way to extend users is the core?

You can define a new relationship type with attributes and the system should allow you to have those appear in the form. Of course, like all the its of OpenACS that were inherited from ACS4, it might not be fully realized, but there is definitely support for at least one way to extend users already.

We need to define what the requirements are before we add more to the core.