Closed (won't fix)
Project:
Voting API
Version:
7.x-2.x-dev
Component:
Miscellaneous
Priority:
Critical
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
14 May 2013 at 09:23 UTC
Updated:
15 May 2013 at 12:02 UTC
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
Comment #1
hkvega01 commentedso 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);
}
Comment #2
torotil commentedHi,
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.