function radioactivity_fivestar_voting_votingapi_insert in Radioactivity 6
Implement hook_votingapi_insert().
File
- plugins/
radioactivity_fivestar_voting.module, line 41 - Fivestar voting support for radioactivity
Code
function radioactivity_fivestar_voting_votingapi_insert($votes) {
require_once drupal_get_path('module', 'radioactivity') . '/radioactivity.inc';
foreach ($votes as $vote) {
$oclass = $vote['content_type'];
$oid = $vote['content_id'];
$value = $vote['value'];
switch ($oclass) {
case 'node':
case 'comment':
switch ($value) {
case 20:
radioactivity_add_energy($oid, $oclass, 'one_star');
break;
case 40:
radioactivity_add_energy($oid, $oclass, 'two_stars');
break;
case 60:
radioactivity_add_energy($oid, $oclass, 'three_stars');
break;
case 80:
radioactivity_add_energy($oid, $oclass, 'four_stars');
break;
case 100:
radioactivity_add_energy($oid, $oclass, 'five_stars');
break;
}
break;
}
}
}