I needed a custom field that couldn't be provided by the core profile module (Select list populated from a SQL query). I was able to successfully add the field with proper options; however, I am unsure how to handle this new field once submitted.
From what I understand, I need to write a function that handles my SQL insert, and then call that function from a hook_form_alter submit button.
As of now, it is passing only the field name, not the value. And the field name is being serialized and stored in the 'data' field of the user table. I'm attempting to pass it to its own column.
Here is my code...
//takes value and inserts it to account field
function accountselect_submitaccount() {
db_query( "INSERT INTO {user} (account)
VALUES {account_name}" );
}
Then...
//call the above function using custom submit (I suspect this is the troubled area)
function accountselect_form_alter(&$form, $form_state, $form_id) {
if($form_id == 'user-register')
$form['#submit'][] = 'accountselect_submitaccount';
}