function userpoints_nc_comment_insert in User points Nodes and Comments 7
Implements hook_comment_insert().
2 string references to 'userpoints_nc_comment_insert'
- userpoints_nc_comment_presave in ./
userpoints_nc.module - Implements hook_comment_insert().
- userpoints_nc_description_callback in ./
userpoints_nc.module - Description callback for userpoints operation description/reason.
File
- ./
userpoints_nc.module, line 432
Code
function userpoints_nc_comment_insert($comment) {
$node = node_load($comment->nid);
// Check if enabled for this node type.
if (!userpoints_nc_get_setting('comment_enabled', $node->type, TRUE)) {
return;
}
$tid = userpoints_nc_get_setting('comment_category', $node->type);
$points = userpoints_nc_get_setting('comment_points', $node->type);
$published_or_all = $comment->status == COMMENT_PUBLISHED || !variable_get('userpoints_nc_comment_published_only', TRUE);
if ($points != 0 && $published_or_all) {
$params = array(
'points' => $points,
'tid' => $tid,
'uid' => $comment->uid,
'operation' => 'userpoints_nc_comment_insert',
'entity_id' => $comment->cid,
'entity_type' => 'comment',
);
userpoints_userpointsapi($params);
}
}