Hi all. I need to import +8000 post from another CMS. My question is about voting field. For every post/node that I need to import I have two field:
* nr_vote : number of the votes
* tot_vote: sum of votes (values from 1 to 5 for every old vote).
How can I import this value to voting api (I need to use 5 stars module into my site) so that when a user make a new vote the old vote are not delete but the new vote goes to add to this old value.
Tnx in advance and sorry for the bad engish.
M.
Comments
Comment #1
eaton commentedUnfortunately, there's no mechanism in VotingAPI for storing *just* an aggregate staring point like that -- it's designed to store individual votes, and then calculate the results itself.
It's possible that you could use a module that implements hook_votingapi_recalculate(), and 'adjusts' the results for the content in question whenever it's calculated. (That way, incoming votes would be added to the existing totals).
If you have the individual votes from your old CMS, you should be able to insert them into the votingapi_votes table directly using SQL, or alternately use the votingapi_add_vote() function in PHP. The API.txt file in the VotingAPI download may be of some help...