There is a way to get the old "sum" value before save ? I need to calculate something and i need both the old and new sum values.
Something like (sum before vote was 8 , sum after vote is 9).
I tried using hook_votingapi_results_alter() but the $vote_results contains only the new data.
I have tried to receive the old data by making querys in votingapi_cache table but with no success. Maybe the data was already gone at that point.
function module_name_votingapi_results_alter(&$vote_results, $content_type, $content_id) {
// get new data
- $vote_results provide the new data. All good.
// get the old data
- query to votingapi_cache return nothing all the time
- tried using votingapi_select_single_result_value() but again it doesn't return anything
}
Is this posible ?
Thank you.
EDIT:
solved using vote up/down api
Comments
Comment #1
istryker commented@Necropsique Curious how you solved it with Vote up/down module. Can you explain.
Comment #2
istryker commentedClosing this issue in favor of #1269614: Add pre-save or pre-set hook before data is store to database. With the preset hook you can grab the sum before the vote is save. This might not solve every scenario, but will solve most.
Marking as fixed
Comment #3.0
(not verified) commentedsolved using vote up/down api