tobias.kochs-online.net

OpenID 3.3.3 & WordPress 2.9.x

| 2 Comments

Today was WordPress maintenance Sunday for me. I sorted out all the spam Akismet hadn’t caught and updated a few of the plugins we are using with WordPress. However I hadn’t enough time to update WordPress itself to version 3.0.1. So we are still running 2.9.2. This caused some trouble when I was upgrading the OpenID plugin to its latest version 3.3.3. Accessing the WordPress admin panel I got stuck with an PHP error reading

Call to undefined function get_user_meta()

WordPress codex tells us this function get_user_meta is not available in WordPress until version 3.0. It is replacing the now deprecated function get_usermeta which is available for earlier versions of WordPress. So I came up with a little hack to get the OpenID plugin running again for my ancient 2.9.2 version of WordPress.

Simply add these lines at the top of the plugin files admin_panels.php, server.php and server_ext.php:

/**
* Hotfix for WordPress 2.x
*/
if ( !function_exists('get_user_meta') ) {
function get_user_meta($user_id, $key, $single = false) {
if ( $single == false )
return array(get_usermeta($user_id, $key));
else
return get_usermeta($user_id, $key);
}
}

This code defines a new function get_user_meta in case it is not existing already. The new function calls the deprecated function get_usermeta and returns the result so the plugin is working as expected again.

Author: Tobias

Hallo, ich bin Tobias. Meine Leidenschaft gilt alten Autos. Je ausgefallener desto besser. Im Alltag schwöre ich auf meinen treuen '88 Volvo 745 und im Laufe der Zeit sammelten sich daneben in der Garage noch ein '79 AMC Pacer, ein '70 Chrysler 300 Hurst, ein '90 Toyota Sera und ein '94 Mazda 121 Ginza. Wenn ich gerade nicht an den Autos herumschraube, lasse ich den Nerd raushängen und schreibe hier irgendwas zu Online- und IT-Themen, Filmen oder Musik. Ihr findet mich auch .

2 Comments

  1. schön und gut … hab auch schon 1000 Mal irgendwelche Hacks programmieren müssen, aber das update auf WP3 dauert max. 5 Minuten und beinhaltet recht viele Verbesserungen und Sicherheitsupdates. Meinste nicht, das wäre einfacher gewesen? 😉

  2. May be you are right and updating to WordPress 3.0 would have been less of a hassle. However I wanted to have a closer look at the Multisite feature of WordPress 3.0 on this occasion because there are five blogs running on this single installation right now and I’m hoping to replace my homebrew solution with this new feature.

Leave a Reply

Required fields are marked *.