function assignment_type_box_save($post_id)
{
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return;
    }
    if (!wp_verify_nonce($_POST['assignment_type_box_content_nonce'], plugin_basename(__FILE__))) {
        return;
    }
    if ('page' == $_POST['post_type']) {
        if (!current_user_can('edit_page', $post_id)) {
            return;
        }
    } else {
        if (!current_user_can('edit_post', $post_id)) {
            return;
        }
    }
    $assignment_type = $_POST['assignment_type'];
    update_post_meta($post_id, 'assignment_type', $assignment_type);
    //send push notification if new assignment
    // if ( !wp_is_post_revision( $post_id ) ){
    $notified = get_post_meta($post_id, 'notified');
    if (empty($notified)) {
        $pushMessage = get_the_title($post_id);
        $reg_ids = users_gcm_ids();
        $deadline = get_post_meta($post_id, 'assignment_date', true);
        $firebase = new FirebasePush($pushMessage);
        $firebase->sendPushNotification();
        assignment_send_push($pushMessage, $post_id, $deadline, $reg_ids);
    }
}
    update_post_meta($post_id, 'assignment_address', $_POST['address']);
    update_post_meta($post_id, 'assignment_location', $_POST['lat_lon']);
    update_post_meta($post_id, 'assignment_target', $_POST['target']);
    if ($_POST['target'] == "specific") {
        update_post_meta($post_id, 'assignment_target_person', $_POST['target_person']);
    }
    update_post_meta($post_id, 'assignment_date', $_POST['deadline']);
    update_post_meta($post_id, 'assignment_bounty', $_POST['bounty']);
    //return success message!
    print 1;
    //send message to targets if any
    /**
     * if target is specific, send only to target_person
     * if target is everyone, send to everyone
     * if target is nearby, look for nearest users(or users in same town)
     */
    $reg_ids = users_gcm_ids();
    if ($_POST['target'] == "specific") {
        //send to specific person
        $user = get_user_by('login', $_POST['target_person']);
        $reg_ids = users_gcm_ids($user->ID);
    } else {
        if ($_POST['target'] == "nearby") {
            //send to people nearby
            $reg_ids = get_nearby_users($_POST['lat_lon']);
        }
    }
    assignment_send_push($_POST['title'], $post_id, $_POST['deadline'], $reg_ids);
} else {
    print 0;
}