Can I do this programmatically or using rules/actions/trigger modules?

Comments

marvil07’s picture

Version: 6.x-2.0-beta1 » 6.x-3.x-dev
Status: Active » Closed (duplicate)

no possible now, take a look to #467220: Integration with rules

lyricnz’s picture

Version: 6.x-3.x-dev » 6.x-2.0-beta1
Status: Closed (duplicate) » Fixed

There is an outstanding issue to provide Rules support for Voting API (and hence Vote Up/Down). See #467220: Integration with rules.

In the meantime, you can always write yourself a custom action, probably using the votingapi_set_votes() API directly. Something like:

    $vote = array();
    $vote['content_type'] = 'node';
    $vote['content_id'] = $node->nid; // the node id
    $vote['value'] = 1;  // or -1
    $vote['value_type'] = 'points';
    $vote['tag'] = variable_get('vud_tag', 'vote');

    $votes = array(0 => $vote);
    drupal_alter('vud_votes', $votes);
    votingapi_set_votes($votes);

Marking as duplicate of the Rules request, okay?

lyricnz’s picture

Status: Fixed » Closed (duplicate)
chandrabhan’s picture

Thank you very much. I will give it a shot.

chandrabhan’s picture

Tried the code piece and it is working fine. Thanks for the help.

marvil07’s picture

Issue tags: +autovote

make it findable :-p