Closed pcraig3 closed 10 years ago
Will adding a method like disableSavingOptions()
be sufficient? (If there is a better method name, let me know.)
Or you may like to just pass an empty string ''
to the first parameter of the constructor so that the framework considers that the user does not want to save any option to the options table. But this might be confusing as currently the default value is null
and if null
is passed, the instantiated class name is used as the option key.
Let me know if you have a better idea.
Initially, I was thinking that there could be a way to specify into which table to insert/update/delete values, but on reflection I don't think that makes too much sense. The WordPress Settings API doesn't use raw database queries, so I very much doubt there's really a place to specify a different table name and/or query to run instead of the default.
Your initial option is probably the simplest. Running a custom query once the form values have been validated makes sense to me, so adding a method to disable the autosave option at the top level would suit me just fine.
Updated the development version 3.1.0b. Download: https://github.com/michaeluno/admin-page-framework/archive/3.1.0b.zip
I added the both methods. You may call the disableSavingOptions()
method in the setUp()
method or just pass an empty string ''
to the constructor's first parameter. Let me know if one of them is not necessary.
Initially, I was thinking that there could be a way to specify into which table to insert/update/delete values,
Ah, there is no means with the framework to do that. Sorry.
On second thought, I feel the method is redundant and passing an empty string to the constructor is just sufficient.
disableSavingOptions()
method.options_{instantiated class name}
filter hook. This can be tested with the file which can be downloaded in the link (3.1.0b) posted previously.
Also posted an example script on Gist. https://gist.github.com/michaeluno/fcfac27825aa8a35b90f
Even when inserting form values into a custom database, the
wp_options
table is still updated. It would be ideal if there were an easy way to cancel submitting a form's values towp_options
table.