Thanks for your plugin! I liked it so much that I couldn't help but give back to it by doing this rewrite. Please provide me with your email address so I can mail you the new code.
First of all, let me state clearly that I'm not all that familiar with WordPress or the WordPress plugin API, so no doubt there will be things which I have missed as I didn't know that is the way things should be done.
One thing which comes to mind straight away and which I haven't looked at, is validating that only users with admin-level priviledges can edit the settings.
The reason I started looking at the code was the none-showing of fields after you've added a new field (I had to go to another screen, then come back to see the list of fields again).
Additionally, if you would add another field - without first reloading the screen-, all previously defined fields would be gone from the database, which was a pain.
Also if you would change the 'field label', you would also change the meta key and lose access to the values which users had already provided.
Ok, so I solved that and as I was working on the code anyway, I solved some other (potential) issues and added some new features.....
What I've done:
- Rewritten the whole admin function to solve the bugs. If you change the field label now, only the label will change, not the meta-key. And the field list will show correctly after adding new fields.
- Replaced some depreciated WP-functions with their replacements and added backward compatibility for those.
- Replaced all text strings which didn't have this, with the __() function to prepare the plugin for translating. I haven't added a language directory yet nor added any translations, I just made the actual plugin code ready for setting this up.
- I also corrected some of the English phrases.
- Added input validation to the admin function. Main restriction: meta keys and labels may now only contain alphanumerical characters within the current locale and spaces.
- Added output validation wherever output was created.
- New feature: added a 'help text' input field so admins can define their own help text to be displayed next to the profile field.
- New feature: added a 'field order' input field so admins can change the order in which the fields are displayed on user profiles. If two fields were given the same order number, they are sorted by their alphabetic meta key.
I've tried to maintain backward compatibility, but I've only tested in WP 3.0.1.
I'd appreciate your feedback and hope you will consider these changes as the compliment to your work which they are meant to be.
It would be great if you would incorporate my changes into a new version of the plugin so that other people can benefit as well ;-)