how to get comment id in custom_comment_form_submit

364 Views Asked by At

How to get comment id in comment_form_submit ?

I built a custom module to send email containing comment details like comment id,url and username. But not getting comment id to generate comment url.

function custom_comment_form_submit($form, &$form_state) {
  //code
}
1

There are 1 best solutions below

0
Max On

The simplest approach would be to install these two modules. With tokens you will have access to a list of tokens that you can use in your email template, including the comment ID. For a tutorial go here (it's for Drupal 7, but it can be used for Drupal 6 as well): How to send email notifications for comments in Drupal 7 with actions & triggers (or the Rules module)

Not to mention an entire array of already built modules that provide this kind of functionality. Don't waste your time on reinventing the wheel. See this list for a comparison of the available modules: Comment Notifications comparison