I have one node on my site that displays different content depending upon a variable that is provided. I also need comments to track to that variable and not just the node itself. I was able to edit the comment_form function in the comment module to add the appropriate line to the form, but I can't figure out where to go next. Here is the line I added.
$form['package'] = array('#type' => 'value', '#value' => $package);
$package is the variable I am trying to pass. I used a type of hidden instead of value initially to confirm that it was being determined correctly.
As far as I can tell, there are two pieces I am missing. The first is that I need the page to refresh with $package intact as part of the URL. This would be the same as the page that a comment is actually entered on. Right now the action points to /comment/reply/5 with 5 being the node id. I need that page to access the $package value from the form before loading /node/5 so it can go to the right page.
For example:
http://linuxappfinder.com/package is the alias of /node/5, but it needs to have a form of http://linuxappfinder.com/package/drupal (where drupal is the app being displayed) in order to display correctly. Current behavior returns me to http://linuxappfinder.com/package#comment-xx after a comment is posted.
I also need the comment_save function to be able to determine the $package value because it updates a table to associate the comment id (cid) with the appropriate package so only the appropriate comments are displayed later.
Does anyone know where I should look to solve this? I back-tracked from the comment_save function to the comment_form_submit function, but I can't tell where the latter gets called from.