Rules must have:
Events: Before saving a comment
Conditions: this code
global $user;
$node =array();
$query = db_select('comment', 'c');
$query->fields('c', array('nid'));
$query->condition('c.uid', $user->uid);
$result = $query->execute();
while ($res = $result->fetchAll()) {
foreach ($res AS $re) {
$node[] = $re->nid;
}
}
if(!in_array($comment->nid, $node)){
return TRUE;
}
Actions: grant users User Points
=============================
Conditions: Execute custom PHP code
or create custom Conditions
/**
* Implements hook_rules_condition_info().
*/
function MYMODULE_rules_condition_info() {
$conditions = array();
$conditions['MYCONDITION'] = array(
'label' => t('lable'),
'parameter' => array(
'user' => array(
'type' => 'user',
'label' => t('User'),
),
),
'group' => t('Custom'),
'callbacks' => array(
'execute' => 'MYMODULE_rules_condition_MYCONDITION',
),
);
return $conditions;
}
function MYMODULE_rules_condition_MYCONDITION($user) {
$node =array();
$query = db_select('comment', 'c');
$query->fields('c', array('nid'));
$query->condition('c.uid', $user->uid);
$result = $query->execute();
while ($res = $result->fetchAll()) {
foreach ($res AS $re) {
$node[] = $re->nid;
}
}
if(!in_array($comment->nid, $node)){
return TRUE;
}
}