Archive for the 'deliciousizer' Category

Not dead

Wednesday, February 9th, 2005

Well, not really, but kind of.

Just “fixed” the deliciousizer.
It seemed a good idea to add the post id to the tags.
It wasn’t.
Now I got thousands of tags ….

It’s gone.
Now I only have to clean up the old posts…

Wordpress and del.icio.us III - For You

Thursday, December 23rd, 2004

OK,
here it is in all its glory ;)

1. Put the plugin into your plugins directory.
2. Set the DEL_USER and DEL_PASS.
3. Put the delicious php class into your plugins/includes directory.
4. Activate the plugin.

Let me know if it doesn’t work.
Or if you have any improvements.

[php]
/*
Plugin Name: Deliciousizer
Version: 0.1
Plugin URI: http://anti.cute-ninjas.com/
Description: Post new posts to del.icio.us
Author: Andreas Neukoetter
Author URI: http://anti.cute-ninjas.com/
*/

$DEL_USER=”YES”;
$DEL_PASS=”SURE”;

require_once(’includes/class.delicious.php’);

function delicious_add( $user, $pass, $link, $title, $tag )
{
//$url = “http://$USER:$PASS@del.icio.us/api/posts/add?url=$link&description=$title&tags=$tags”;
$del = new delicious( $user, $pass );
$now = strftime( “%C%y-%m-%dT%H:%M-%S” );
$del->add_post( $link, $title, “”, $tag, $now );

}
function post_to_delicious( $id )
{
global $wpdb, $tableposts, $tablepost2cat, $tablecategories;
global $DEL_USER, $DEL_PASS;

$post_title = $wpdb->get_var(”SELECT post_title FROM $tableposts WHERE ID=$id;”);
$title = “Anti’s Blog [”.$id.”] - “.$post_title;
$tags = “[wp-anti] [wp-$id] blog”;

$post_cats = $wpdb->get_results( “SELECT category_id FROM $tablepost2cat WHERE post_id=$id;” );
foreach( $post_cats as $post_cat ){
$post_cat_title = $wpdb->get_var(”SELECT cat_name FROM $tablecategories WHERE cat_ID=”.$post_cat->category_id.”;”);
$tags = $tags.” “.$post_cat_title;
}
$link = get_permalink( $id );

delicious_add( $DEL_USER, $DEL_PASS, $link, $title, $tags );

return( $id );
}

add_action( ‘edit_post’, ‘post_to_delicious’,9 );
add_action( ‘publish_post’, ‘post_to_delicious’,9 );
[/php]

BTW:
Thanks to Daryl for PHPizer


anti’s blog is proudly powered by WordPress
Entries (RSS) and Comments (RSS).