By iancawthorne on
I have used views to display nodes with their comments on one page.
This means if there are say 10 nodes on the page, there are 10 comment submission forms.
When I submit the comment form, it submits to the node page the comment form is for, not the view page I submitted it from.
Is there a way to override this using hook_form_alter or the &destination option for example?
Comments
Yes, you can change the
Yes, you can change the form's destination in hook_form_alter -- see the FormAPI reference for how.
http://api.drupal.org
use theme developer to give you a list of candidate hook names, probably
MYTHEMENAME_comment_form_alter(&$form, $form_state, $form_id)
MYMODULENAME_comment_form_alter(&$form, $form_state, $form_id)
see http://api.drupal.org/api/function/comment_form_alter/6
That's for theme functions.
That's for theme functions. Hook_form_alter is not a theme function.
Drupal 7
I'm wondering how to do this in Drupal 7.
Form id's for comment form's seem to be node type specific so instead of being 'comment_form' or whatever it was in D6, its now "comment_node_NODE_TYPE_form"...
I need to have one function that changes all comment types for all forms, but can't figure out how.
Ha - figured it out now.
Ha - figured it out now. Use:
I got something
oops. wrong thread.
Comments are now an entity in
Comments are now an entity in Drupal 7, so you can modify what fields display in them