Wordpress integration issue

Beginning at line 507, discourse.php

if( property_exists( $json, 'id' ) ) {
  $discourse_id = (int) $json->id;
}

if( isset( $discourse_id ) && $discourse_id > 0 ) {
  add_post_meta( $postid, 'discourse_post_id', $discourse_id, true );
}
  }
} else {
  // for now the updates are just causing grief, leave'em out
  return;
  $url = $options['url'] .'/posts/' . $discourse_id ;
  $post_options = array( 'method' => 'PUT', 'body' => http_build_query( $data ) );
  $result = wp_remote_post( $url, $post_options );
  $json = json_decode( $result['body'] );

  if(isset( $json->post ) ) {
    $json = $json->post;
  }