AddThis WordPress Plugin with WPMU

UPDATE 2/9/2010: AddThis recently released a version 1.6.1 which fixes the issues. It contains *basically* this patch with if ( wordpress version > 2.7 ) checks to maintain backward compatibility. I wasn’t worried about that because people shouldn’t run old, unsecure versions of wordpress, however I can see why AddThis wouldn’t care and would want their plugin to work across the board.

Recently, I wanted to add the AddThis WordPress Plugin and I couldn’t get it to work with WPMU. I found a thread on the addthis forums that discussed the exact problem, with a suggestion like the openid problem that had been updated.

The post/bug report on openid suggested to update the plugin to use the new register_setting/settings_fields methods which are now available with WordPress 2.7 and above. The documentation for that is here: http://codex.wordpress.org/Creating_Options_Pages.

I made the same changes, and everything seems to work. Here is a patch:

addthis_wpmu_fix.patch

diff --git a/addthis_social_widget.php b/addthis_social_widget.php
index 39c4a5c..3ed2c5c 100644
--- a/addthis_social_widget.php
+++ b/addthis_social_widget.php
@@ -51,6 +51,26 @@ $addthis_styles = array(
                         , 'custom' => array('img'=>'http://example.com/button.gif', 'w'=>16, 'h'=>16) */
                     );

+if ( is_admin() ) {
+    add_action( 'admin_init', 'register_addthis_settings' );
+}
+
+function register_addthis_settings() {
+    register_setting('addthis', 'addthis_username');
+    register_setting('addthis', 'addthis_style');
+    register_setting('addthis', 'addthis_sidebar_only');
+    register_setting('addthis', 'addthis_isdropdown');
+    register_setting('addthis', 'addthis_showonpages');
+    register_setting('addthis', 'addthis_showoncats');
+    register_setting('addthis', 'addthis_showonhome');
+    register_setting('addthis', 'addthis_showonarchives');
+    register_setting('addthis', 'addthis_language');
+    register_setting('addthis', 'addthis_brand');
+    register_setting('addthis', 'addthis_options');
+    register_setting('addthis', 'addthis_header_background');
+    register_setting('addthis', 'addthis_header_color');
+}
+

 /**
 * Adds WP filter so we can append the AddThis button to post content.
@@ -216,7 +236,7 @@ function addthis_plugin_options_php4() {
     

AddThis

- +

Required

@@ -305,9 +325,6 @@ function addthis_plugin_options_php4() {
- - -

Bookmark and Share

Post a Comment

Your email is never published nor shared. Required fields are marked *