Currently the registration form only includes fields from the users table. What I generally do if I have additional information I want the user to give me upon registration is force them to a particular form after they have registered.
E.g. in the Application delegate class you can implement the beforeHandleRequest() method that checks to see if the user has created a profile yet, and if not, redirects them to the "New Profile" form with a message asking them to complete their profile to continue.
For example:
- Code: Select all
function beforeHandleRequest(&$record){
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
$auth =& Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();
if ( $user and !$user->val('profile_id') ){
// profile hasn't been created yet
if ( !($query['-table'] == 'Profiles' and $query['-action'] == 'new' )){
// We aren't on the new record form of profiles - so
// let's redirect there
header(DATAFACE_SITE_HREF.'?-action=new&-table=Profiles&--msg='.urlencode('Please fill in your profile to continue.'));
exit;
}
}
}
Note that with this scheme you probably want to do the following also:
1. Set permissions so that users can't create more than one profile.
2. add an afterInsert() trigger to the Profile's table to automatically add the profile_id to the current user's record in the Users table.
-Steve
}
}
}