So I've gone with #3 above, question is: how do I insert a post id into my new table? I've got the new SQL statment pluging all the info in, including GeoPress's stuff & the Blog ID. Here's the function in question:
function update_geo ($id, $name,$loc,$coord,$geom,$warn,$mapurl,$visible = 1) {
global $table_prefix, $wpdb, $blog_id, $post, $id;
$post2 = get_post($id, ARRAY_A);
$wade = $post2['ID'];
if($name == "") { $visible = 0; }
$table_name = "geopress";
$sql = "SELECT * FROM ".$table_name." WHERE geopress_id = '".$id."' OR name = '".$name."' LIMIT 1";
$row = $wpdb->get_row( $sql );
//TODO SQL INJECTION POSSIBLE?
if ($row) {
$geo_id = $row->geopress_id;
$sql = "UPDATE ".$table_name." SET name = '$name', loc = '$loc', coord = '$coord', geom = '$geom', warn = '$warn', visible = '$visible', mapurl = '$mapurl', blog_id = '$blog_id', post_id = '$wade' WHERE geopress_id = '$geo_id'";
$wpdb->query( $sql );
} else {
$sql = "INSERT INTO ".$table_name." VALUES (NULL,'$name','$loc','$warn','$mapurl','$coord','$geom',NULL,NULL,NULL,NULL,NULL,'$visible', '$blog_id', '$wade')";
$wpdb->query( $sql );
$geo_id = mysql_insert_id();
}
return $geo_id;
}
echoing the post ID works fine:
$post2 = get_post($id, ARRAY_A);
$wade = $post2['ID'];
echo $wade;
I'm guessing it's something pretty basic, if I do finally figure it out, I will of course share here.