<?php
	function get_new_specialty_id( $old_spec_id ) {
		$query = sprintf( "select specialty_id from specialties where oldid=%d" , $old_spec_id );
		return FNTH_db_get_field( $query , "specialty_id" );
	}

	function fo3_migrate_user_specialties( $db , $old_user_id , $member_id ) {
		$query = sprintf( "select spec_id from fo_xref_user_specialties where user_id=%d" , $old_user_id );
		$old_spec_ids = FNTH_db_get_column( $query , "spec_id" , $db );
		$ins = array();
		$ins["member_id"]=sprintf( "%d" , $member_id );
		foreach ($old_spec_ids as $old_spec_id) {
			$ins["specialty_id"]=get_new_specialty_id( $old_spec_id );
			FNTH_db_free_result( FNTH_db_query(
				FNTH_db_generate_insert_query( "member_specialties" , $ins ) ) );
		}
	}	
?>
