November 2010
6 posts
7 tags
WordPress 3.0 - wp_list_authors does two queries...
WordPress is querying the database twice for every single user in WordPress when fetching authors. While it isn’t such an issue for a small blog, it was a major issue for my client. What had happened is that he was printing a list of the authors as a menu item and the resulting very simple statement. Resulted in 17118(!) database queries. It caused such a big problem that his database...
Nov 24th
12 notes
8 tags
Nautilus times out when trying to mount SFTP share
If you are inputting the SSH password in the keyring password box when connecting to a server and the input box displays: Enter passphrase for key as [user] on [server] It means that it’s asking for a ssh-key passphrase rather than the servers ssh password. If you choose to input nothing it instead gives you the option for the servers ssh password that reads: Enter password for ssh as...
Nov 21st
5 notes
3 tags
Delicious feed API - Trailing slash needed in MD5...
Delicious lets you access public data through feeds, which is nice since then you don’t have to go around doing the whole OAuth bit. I wanted to get the tags associated with a link, which the API page tells me are in this feed: http://feeds.delicious.com/v2/json/urlinfo/{url_md5} So naturally I did an MD5 on http://www.google.com and called ...
Nov 17th
2 notes
6 tags
PHP 5.2 - Defining __DIR__
I found out one of my client had PHP 5.2 which is lacking the magic constant __DIR__ which doesn’t exist prior to PHP 5.3. If you don’t want to change your code to replace it with the old dirname( __FILE__ ) you can simply define it yourself like so: if( !defined( __DIR__ ) )define( __DIR__, dirname(__FILE__) );
Nov 8th
2 notes
4 tags
WordPress Plugin - All function declared twice on...
This happens when code in the function called by register_activation_hook throws an exception, in my case caused by a faulty SQL query. When this happens WordPress includes the plugin file again (possibly as an attempt to recover from the error) which in turn caused the error message that my functions were being redeclared. The solution is to simply debug the function called by...
Nov 6th
7 notes
4 tags
WordPress - The plugin generated unexpected output...
When activating a plugin in WordPress, if you get an error message complaining about unexpected output from the plugin it’s probably because something in your code is echoing when it’s being included. The plugin generated 1 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try...
Nov 6th
5 notes