I have developed a plugin for WordPress that is called DiveBook with the purpose of logging dives. I have now had it published at WordPress Plugin Directory for a while as a beta version. In this post I will talk about bugs and issues I experienced during the beta period and how I solved them.
Unexpected output during activation
The first issue I got was that when activating the plugin the following error message were displayed
The plugin generated 2 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin
I also found that this issue interfered with the log in and sign out pages in wordpress (redirecting problems).
I quickly found that I were using global variables in the function I’m passing to register_activation_hook() and that the function passed to register_activation_hook() does not have access to global variables. Read more about it at WordPress Function Reference for register_activation_hook().
When I stopped using global variables in the function the error message on activation disappeared and also the issues with log in and sign out. Great!
Issue when editing posts, pages or links
A user reported that selecting Add an image to a post did not work correctly when my plugin was activated.
I found that this error was related to script loading, jQuery scripts to be specific.
To fix this issue I added some code so that my jQuery scripts were not enqueued on admin pages. Read about this at WordPress Function Reference for wp_enqueue_script().
GUI issues with other themes
This was really a pain, several users reported displaying issues when the plugin was running on their themes. Most of these issues were easy to fix by adding more specific CSS code, but some issues were a real pain in the *** to figure out how to solve.
I had one problem with StationPro 3 from Pageline where the popup windows was placed far left on the page with a very narrow view. The CSS for this popup is generated on the fly by using document.documentElement.clientWidth and document.documentElement.clientHeight. I changed this to use jQuery(window).height() and jQuery(window).width(). I also placed my popup windows at a fixed position to avoid issues with other themes.
A good advice is to be specific when you make the CSS for your plugin to ensure that CSS-files following WordPress and Theme will not interfere with your plugin.
The Divebook plugin has passed it’s beta period and version 1.0.0 was released to day. You can find the DiveBook plugin at WordPress Plugin Directory.