[wp-hackers] Best way to kick off actual work from plugin settings page?
Jeremy Clarke
jer at simianuprising.com
Mon Jul 12 13:43:50 UTC 2010
On Mon, Jul 12, 2010 at 3:27 AM, Matt Jacob <matt at mattjacob.com> wrote:
>
> Maybe I'm getting too philosophical, but it seems like too much work to do
> from a function that's supposed to validate/sanitize inputs. I don't see a
> better way, though.
>
>
I don't think you're being too philosophical, your argument against using
the sanitization callback for upgrades/management makes sense.
Right now it seems like the sanitization callback is only used as part of
the Settings *Pages* API to process the data, this implies that you could do
anything in the callback that is part of your settings page. The problem is
that conceptually it isn't supposed to be the callback for your settings
page, its supposed to be the filter for the data in that specific setting.
IMHO the way the API is written intends that the filter could be run in
other circumstances to santize the data in your setting. Given this I think
adding logic that isn't related to validating setting fields is probably
better avoided if possible.
IMHO the admin_init route would be better. Essentially you're just falling
back to the pre-API way of managing settings pages, which makes sense
because in your described scenario you aren't actually managing the setting,
you're doing upgrade/management tasks. Those should stay on the page and
leave the Settings definitions as pure as possible.
--
Jeremy Clarke | http://jeremyclarke.org
Code and Design | http://globalvoicesonline.org
More information about the wp-hackers
mailing list