Well I have got most of it working..
But there are some problems. The Digg url still dosen't show up eventhough it is there in the database..
And how do i get the permalink of the post in the code (see below)
add_action('wp_insert_post', 'diggurl_insert_post');
function diggurl_insert_post($pID) {
global $wpdb;
extract($_POST);
$wpdb->query(
"UPDATE $wpdb->posts SET
digg_url = '$digg_url'
WHERE ID = $pID");
}
add_action('dbx_post_sidebar', 'diggurl_addfield');
function diggurl_addfield() {
global $post;
?>
<fieldset id="posturl" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Enter the Digg URL'); ?>:</h3>
<div class="dbx-content"><input name="digg_url" type="text" size="21" id="digg_url" value="<?php echo $post->digg_url ?>" /></div>
</fieldset>
<?php
}
add_action('activate_diggthis.php', 'diggurl_addcolumn');
function diggurl_addcolumn () {
global $wpdb;
$wpdb->query("ALTER TABLE $wpdb->posts ADD COLUMN digg_url varchar(128)");
}
add_action('deactivate_diggthis.php', 'diggurl_removecolumn');
function diggurl_removecolumn () {
global $wpdb;
$wpdb->query("ALTER TABLE $wpdb->posts DROP digg_url");
}
function show_digg_this () {
$diggurl = $post->digg_url;
$digg_permalink = the_permalink();
if ( strlen($diggurl) > 0 )
echo '
$digg_url
'
;
else
echo '
<div id="digg_this_button">
<*a href="http://digg.com/submit?phase=2&url=$digg_permalink" title="Add to Digg">
<img src="digg_button.gif" alt="Digg Button" />
</div>
';
}