Ive been testing my site and am about ready to set it live, but I need to reset all of the votes... how do I do this?!?!?

Comments

eaton’s picture

Status: Active » Closed (fixed)

There's no built-in feature for vote resetting, but running the SQL queries:

TRUNCATE votingapi_vote;
TRUNCATE votingapi_cache;

will clear out all of the vote data. Good luck!

dergachev’s picture

Thanks, that's just what I came here to confirm.

But this brings up a question: why doesn't voting API expose an admin page that allows basic functionality like this?
No matter what voting widget one might use, having a simple way to manage votes is necessary.

And if Voting API is purposely limited, is there a basic "admin votes per node" module that everyone's using?

Doronro’s picture

hi,
this is quite an old thread. is this still the best way to go about it?
how can i run those commands? i've yet to install drush on my site as i feel it's a bit out of my league. is there a module that allows to run such commands from within the interface?
many thanks for any info.

ps i tried the dba module but it gives me an error so i'm looking for another way..

Doronro’s picture

in case any other beginners stumble upon this issue, i ended up doing it with phpMyAdmin through cPanel on my hosting company...

Anonymous’s picture

Issue summary: View changes

Even with Doronro's comments I was unsure of what to do.
Through phpMyAdmin I went to the two tables below that were found in my database.
votingapi_vote;
votingapi_cache;

For each one I clicked "select all items" and then deleted them all.
That's it.
I double checked my database's integrity by having cPanel do a check. It says it's ok.
I flushed the Drupal cache.
All of the stars, for all of my items you can vote for were returned to zero.

Maybe someone else could chime in that this is the correct way to do it, but it seems to have worked for me.

rishi.kulshreshtha’s picture

You can do this in your module or via devel/php

$entity_type = "node";
$cache = db_delete('votingapi_cache');
$votes = db_delete('votingapi_vote');

if (!empty($entity_type)) {
  $cache->condition('entity_type', $entity_type);
  $votes->condition('entity_type', $entity_type);
}

$cache->execute();
$votes->execute();
jwineichen’s picture

very helpful; thanks @rishi for documenting this