Write one plugin without repetition, deviation or hesitation
How can plugin development be made even easier?
If you’ve ever developed a WordPress plugin (if not why not?) you have probably found that a lot of your time is taken up with things that are effectively a default. This could be something as simple as adding a wrapper div around an admin page or more complicated like accessing a database table.
WordPress abstracts some of this away already; You can save and retrieve options for your plugin without touching the database at all but there are many other cases where things could probably be so much simpler.
I’d like to know what those things are.
Feedback on my plugin generator has been great and I plan to continue developing it, but I want to make things easier still so I want you to tell me what you find to be a chore. What can’t you do simply that you should be able to, what do you have to code which should be automatic, etc.
To get the ball rolling here is one thing that I find a pain: user input. I want to be able to specify that a form field is required, and do nothing. I don’t want to check if the form has been submitted, I don’t want to check if it has content or not, I just want to know that every required field is completed.
How about you?
p.s. If you’re wondering where the post title comes from have a read of this.
Comments
Leave a Reply
I am currently testing a comment link policy which means commenters do not get a link. There is a poll, and open comments for feedback on the comment policy page.

1
Tom commented at 5:08 am, 13th 12 2007:
I realize this may be a noob question, but I’m having trouble saving my admin options with a plugin generated from a previous version of the generator. I have no problem replacing the admin menu with my html form and getting options to populate into the fields, but I’m not sure the best way to save those options. It seems like the constructor of the plugin class is reloading the options before I can save any options that were submitted. I’ve try catching the post of the form in the constructor and saving the options, else refetching them, but that doesn’t seem to work. Any help is appreciated.
2
Andrew Rickmann (http://www.arickmann.co.uk) commented at 8:59 am, 13th 12 2007:
Tom,
The constructor will populate the admin options when it loads, what you need to do is to capture the post options as part of the admin page itself, rewrite it and save it, before any of the content is loaded. For example:
function output_menu_function(){
if ( isset($_POST['whatever'] ) {
//validation
$adminOptions['key'] = $_POST['x'];
$this->saveAdminOptions();
}
?>
admin page here
}
If you are still having problems let me know.