This is an embarrassingly basic question, but I'm spinning in circles trying to figure out how to use _fivestar_cast_vote() to programmatically cast a vote.
I'm looking here: http://drupalcontrib.org/api/drupal/contributions!fivestar!fivestar.modu...
and see _fivestar_cast_vote($entity_type, $id, $value, $tag = NULL, $uid = NULL, $skip_validation = FALSE)
...what I don't know is (and trial and error hasn't gotten me there) we need the $entity_type for which entity? What do we need the id for in $id? The rest seems self-explanatory, and probably $entity_type and $id should be self-explanatory.
Am I looking for the ID of the node to be voted on or of the field that defines the vote? Do I need the type of the node or the field?
Probably a single usage example would suffice. I don't think I'm a complete idiot, but after about six hours of trial and error I'm at the end of my rope. I don't know whether I'm doing something wrong in the call or outside the call and just spinning my wheels.
Thanks in advance!
Comments
Comment #1
ericduran commentedSee http://drupalcontrib.org/api/drupal/contributions%21fivestar%21fivestar.... for example.
The id is equal to the entity_id in a node that would be an nid.
Comment #2
matthew1471 commentedJumping in on this.
I've been playing around with _fivestar_cast_vote today, and managed to get it inserting votes into the votingapi_vote table.
What should happen next to apply them against the node or comment?
Cheers,
Matt