I finally got it working! The following will change the registration and profile forms to output role selection as a select form field.
Include the following in the module:
//replace roles checkboxes in registration form with select field
function MYMODULE_form_user_register_form_alter(&$form, &$form_state, $form_id) {
if ( $form_id == 'user_register_form') {
$form['account']['roles']['#type'] = 'select';
$form['account']['roles']['#required'] = TRUE;
}
}
//replace roles checkboxes in profile form with select field
function MYMODULE_form_user_profile_form_alter(&$form, &$form_state, $form_id) {
if ( $form_id == 'user_profile_form') {
$form['account']['roles']['#type'] = 'select';
$form['account']['roles']['#required'] = TRUE;
}
}
//hack for registration & profile forms, attaches the authenticated role
function MODULE_user_presave(&$edit, $account, $category) {
if (isset($edit['roles'])) {
is_array($edit['roles']) ? '' : $edit['roles'] = array ( $edit['roles'] => $edit['roles'], 2 => '1' );
$edit['roles'] = array_filter($edit['roles']);
}
}