How to Fix Sharebar Plugin issue after upgrading to WordPress 3.5

  • Buffer
  • Buffer

WordPress_logo

ShareBarI had an issue with the Sharebar plugin today after I upgraded this blog to WordPress version 3.5. As always when making major WordPress upgrade on my blog I had made a backup of my files and database. This issue was not that big that my blog became inaccessible, but it was still annoying. I went for the Sharebar page at WordPress.org to look for an update to the plugin, but no luck :-( I decided to disable the plugin and started to look for others with the same problem. It was actually not that hard and I even found a couple of solutions/workaround to make it work without any errors on my blog.

 

The issue after upgrading to WordPress 3.5

After upgrading my blog I got this error on top of all my posts. The Sharebar actually looked like it was working, but I was not happy with these lines in top of all my posts:

Warning: Missing argument 2 for wpdb::prepare(), called in /var/www/techwork.dk/public_html/wp-content/plugins/sharebar/sharebar.php on line 112 and defined in/var/www/techwork.dk/public_html/wp-includes/wp-db.php on line 990

Warning: Missing argument 2 for wpdb::prepare(), called in /var/www/techwork.dk/public_html/wp-content/plugins/sharebar/sharebar.php on line 124 and defined in/var/www/techwork.dk/public_html/wp-includes/wp-db.php on line 990

 

The Fix  to make ShareBar work with WordPress 3.5

If you know how to edit a PHP file in a text editor all you need is to edit the 2 lines creating this error in sharebar.php in your plugin folder. What I did was downloading the file via FTP to my PC to make sure that I had a copy if something went wrong. I then changed the 2 lines as stated below and uploaded it back to the sharbar plugin folder.

Line 112 looks something like this:

$results =$wpdb->get_results($wpdb->prepare(“SELECT * FROM “.$wpdb->prefix.”sharebar WHERE enabled=1 ORDER BY position, id ASC”)); $str .= “\n”;</a>

Correct line 112 to look like this instead:

$results =$wpdb->get_results($wpdb->prepare(“SELECT * FROM “.$wpdb->prefix.”sharebar WHERE enabled=1 ORDER BY position, id ASC”, null)); $str .= “\n”;


Line 124 looks something like this:

$results = $wpdb->get_results($wpdb->prepare(“SELECT * FROM “.$wpdb->prefix.”sharebar WHERE enabled=1 ORDER BY position, id ASC”)); $str .= “\n”;

Correct line 124 to loo like this instead:

$results = $wpdb->get_results($wpdb->prepare(“SELECT * FROM “.$wpdb->prefix.”sharebar WHERE enabled=1 ORDER BY position, id ASC”, null)); $str .= “\n”;

That should be all you need to do. It did the trick for this blog and I hope it can work for you too until the ShareBar gets an official update. I know a lot of people out there that are using the ShareBar plugin so I thought I would share this fix with you guys. I have heard that there should be other plugins out there with issues after the upgrade to WordPress 3.5. This is just another good reason to always keep your plugins as updated as possible.


avatar

About Thomas

I am an IT Professional that has this blog as a hobby project in my spare time. I have been in the IT business since 1996 and want to share some of the thing I have picked up over the years with people who visit this blog... Connect with me on: Twitter | Google+ | YouTube Subscribe to my Newsletter