function userpoints_nc_comment_delete in User points Nodes and Comments 7
Implements hook_comment_delete().
1 string reference to 'userpoints_nc_comment_delete'
- userpoints_nc_description_callback in ./
userpoints_nc.module - Description callback for userpoints operation description/reason.
File
- ./
userpoints_nc.module, line 542
Code
function userpoints_nc_comment_delete($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 (userpoints_nc_get_setting('comment_delete_deduct', $node->type, TRUE) && $points != 0 && $published_or_all) {
$params = array(
'points' => -$points,
'tid' => $tid,
'uid' => $comment->uid,
'operation' => 'userpoints_nc_comment_delete',
'entity_id' => $comment->cid,
'entity_type' => 'comment',
);
userpoints_userpointsapi($params);
}
}