Registration Form

A place for users and developers of the Xataface to discuss and receive support.

Registration Form

Postby rwzhao » Sun Feb 22, 2009 11:07 pm

Hello! Steve,

I have a couple of questions regarding the registration form.

1. I have two tables - User and Profiles
Users: (id, username, password, email,profile_id)
Profiles:(profile_id, firm_name, address, phone, etc)

2. User_table will be Users.

3. How can customize registration form to have the fields from both tables? After the user registered and validated, how can update the both tables using the collected data from table-dataface__registration.

Thanks.
rwzhao
 
Posts: 14
Joined: Mon Sep 01, 2008 10:04 pm

Postby shannah » Mon Feb 23, 2009 7:34 pm

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
}
}
}
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby rwzhao » Wed Feb 25, 2009 12:15 am

Steve,

Thanks.

Follow your instruction, I get the warning message at the top of the page:

Warning: Missing argument 1 for conf_ApplicationDelegate::beforeHandleRequest(), .....

Still not direct to other page.

I have checked all the typing in the code and it seems no mistypes.
rwzhao
 
Posts: 14
Joined: Mon Sep 01, 2008 10:04 pm

Postby shannah » Wed Feb 25, 2009 9:18 am

Sorry... beforeHandleRequest actually doesn't take any arguments. Remove the &$record parameter.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 6 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved