I'm using Drupal 6 and its core comment module.
I want to run a custom funcion every time a user posts a comment, but 开发者_Python百科I don't want to mess with the comment.module for obvious reasons.
Is there a practical way I can do this in a custom module? If not, what are the alternatives as I don't want to write my own commenting system.
The Drupal core api provides a hook for interacting with comments.
See http://api.drupal.org/api/function/hook_comment  
Implement hook_comment in your custom module's .module file.
For example:
/**
 * Implementation of hook_comment().
 */
function modulename_comment(&$a1, $op) {
  switch ($op) {
    case 'insert':
      // Call custom function here.
      break;
  }
}
Perhaps an easier way is to setup a trigger and action using the trigger module.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论