This code implicitly creates $submitted as a stdClass, which triggers constant logged warnings in our configuration:

// add case
  else {
    $submitted->changed = db_result(db_query("SELECT created FROM {node} WHERE uid = %d and type = '%s' ORDER BY created DESC LIMIT 1", $user->uid, str_replace("-", "_", $path_args[2])));
  }

Adding $submitted = new stdClass; just after the else { fixes it.