I have a problem with my module for giving assess by submit original knobs in comments. I cannot pull ‘cid’ for VotingAPI module
example:

/* hook_comment in time of creating, I think comment already has ID
*/

function tcomment_comment($comment, $op) {
  switch ($op) {
    case 'publish':
   tcomment_add_votes($comment->cid);
   }
}

/* I use VotingAPI module for storage data. The ‘cid’ is nothing here. Why?
*/

function tcomment_add_votes($cid) {

$votes[] = array(
    'content_type' => 'comment',
    'content_id' => $cid,
    'value_type' => 'points',
    'value' => 1,
    );
    votingapi_set_votes($votes);
}

Comments

anrn’s picture

I solve it

$cid = db_result(db_query('SELECT MAX(cid) FROM {comments}'));

http://drupal.org/node/369520

anrn’s picture

ye, realy, only select max. I think it's hack, not hook, but don't know the best way)