custom user tables supported in SharDB plugin?

Ok, looking into this, I found a little bug in the tables function (beginning on line 1088) in the db.php script file that comes with SharDB. It was this bit of code that was the problem (starting on line 1114 of db.php): if ( isset( $tables[‘users’] ) ) { if( defined( ‘CUSTOM_USER_TABLE’ ) ) $pre_tables[‘users’] …

Read more

Fastest way to get the comment and ping total count for a post

you can use this custom function in the functions.php of the theme: /** * count for trackback, pingback, comment, pings * * embed like this: * fb_comment_type_count(‘pings’); * fb_comment_type_count(‘comment’); */ if ( !function_exists(‘fb_comment_type_count’) ) { function fb_get_comment_type_count( $type=”all”, $zero = false, $one = false, $more = false, $post_id = 0) { global $cjd_comment_count_cache, $id, $post; …

Read more

Output custom content not from the posts table?

Basically you want custom posts in WordPress that will be just pointers to external data? If you don’t want full import then: Store some kind of unique property identifier (that makes sense for your external data) as meta field or guid in custom post type. Make wrapper function that will take ID of your custom …

Read more

Insert post in another database

You could avoid SQL altogether and use the XML-RPC API. This would also let you post to remote wordpress installs too. ( note if XML-RPC is not an option, scroll further down ) If Using XML-RPC Here’s some code from a quick google search using XML-RPC to post to a remote WordPress blog: http://en.forums.wordpress.com/topic/great-code-for-remote-posting?replies=5 Here’s …

Read more

Switching database on the fly

Yes it works! This is the code, assuming both the databases share the same username & password: $wpdb->select(‘mydbname’); wp_cache_flush(); Once done, re-issue the same statements, with the original database name. Can’t see any performance issue at the moment, maybe because this is done when building a custom form picking data from two posts out of …

Read more