I’m having some issues with trying to put the WP-Twitip-ID plugin into the final version.

Right now, the beta version stores the twitter ID in the post meta for each post but that’s not really ideal because it can only show the twitter id on the comments of the post that the user has already commented on. New post comments require the user to add their twitter id again. Not too much trouble because if they have entered a twitter id in a previous comment then the plugin sets a cookie on their machine and adds it to the field when they comment again.

What I’d rather do is store the twitter id in the database so it’s accessible outside the post meta. I could store the id’s in wp_options but that would probably cause loading time issues because wp_options values get loaded automatically and considering the amount of comments a blog gets, it would bloat it out massively.

My solution is to create a new table on the database and add the twitter id and email address in there, that way I only have to update the db once when a new twitter id is entered.

The problem I am having is creating the table! for some reason, it’s not adding it. I’ve even copied and pasted another plugins code to do it and it still wont work!

here’s my code :

function atf_install() {
global $wpdb;
global $atf_db_version;
add_option("atf_db_version", $atf_db_version);

$table_name = $wpdb->prefix . "wptwitipid";
if($wpdb->get_var("show tables like '$table_name'") != $table_name) {
$sql = "CREATE TABLE " . $table_name . " (
id mediumint(9) NOT NULL AUTO_INCREMENT,
email varchar(120) NOT NULL,
twitid varchar(120) NOT NULL,
KEY email (email)
);";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
}
}
$atf_db_version = "1.0";
register_activation_hook(__FILE__, 'atf_install');

There’s a problem with the $atf_db_version too. It adds an option to wp_options for the key of “atf_db_version” but no value and it’s really starting to piss me off!

anyone out there in geek land that can help me here?

Fixed!!

A massive thanks to @clearskynet who answered and solved the problem within minutes of me posting this.

hurray!!