Is it possible to apply different voting criteria to different fivestar fields or other module depending voteapi?

Case 1

fivestar_field1 of content1:
Anonymous vote rollover : 5min
Registered user vote rollover : 5min

fivestar_field2 of content2
Anonymous vote rollover : 10min
Registered user vote rollover : 10min

Case 2
fivestar_field1 of content1
Anonymous vote rollover : 5min
Registered user vote rollover : 5min

advanced poll of all nodes:
Anonymous vote rollover : never
Registered user vote rollover : never

Is it possible to do like this?

Comments

hkvega01’s picture

so sad need to hard code

function votingapi_select_votes($criteria = array(), $limit = 0) {
$window = -1;
if (empty($criteria['uid']) || $criteria['uid'] == 0) {
if (!empty($criteria['vote_source'])) {
if ($criteria['tag']=="heat") {
$window = 1800; //30 min
} else {
$window = variable_get('votingapi_anonymous_window', 86400);
}
}
} else {
if ($criteria['tag']=="heat") {
$window = 300; //5min
} else {
$window = variable_get('votingapi_user_window', -1);
}

}
if ($window >= 0) {
$criteria['timestamp'] = REQUEST_TIME - $window;
}
//var_dump($criteria);
$function = variable_get('votingapi_storage_module', 'votingapi') . '_votingapi_storage_select_votes';
return $function($criteria, $limit);
}

torotil’s picture

Version: 7.x-3.x-dev » 7.x-2.x-dev
Status: Needs review » Closed (won't fix)

Hi,

As you found yourself: this is not possible in 2.x - Maybe using the field_api (with some fallbacks for non-fieldable entities) are the way to go in 3.x.

Thanks for documenting this here.