add_action for publish_post doesn’t work

No offense, but I think I’m agreeing with a commenter from your other question… You really need to read PHP, MySQL, and regular expression tutorials before you get into any of this. More importantly, you need to learn how to search a code base using regular expressions in your favorite editor, and understand the code you’re reading.

Just to give you a few examples, this:

SHOW TABLES LIKE '$table_1 AND $table_2'

Is looking for a table called:

$wpdb->prefix . "voter_ips AND " . $wpdb->prefix . "vote_posts"

Bad, bad, bad…

Along the same lines, while your tables both have a not null unique key, which technically amounts to a primary key, the MySQL rewrite engine and optimizer don’t treat those in the same way as primary keys, so you should declare it as such instead.

Then, there are the potential security holes:

SELECT vote_post_id FROM wp_vote_posts WHERE vote_post_id = $post_ID

… without casting $post_ID to (int) beforehand…

It also helps to var_dump() stuff if you’re not using a PHP debugger. e.g. in your add_votes() call, how about this, to see what’s happening?:

var_dump($post_ID);die;

tech