Personally I think you're best off using a plugin to check values and throw the error.
Hook the plugin to admin_options_processing and compare $settings['your_setting_name'] and throw the error if it's not correct or empty.
I don't know if that's the absolute correct hook, but I think it will work. Otherwise, you have to intercept $data before it's written to the settings database.
Hey nhawk, thanks for your reply. I tried something like what you suggested;
PHP Code:
if ($settings['cotw_sotw_pay_credits'] == 1) {
if (empty($settings['cotw_sotw_first_place_prize'])) {
$error = 'invalid_value';
return false;
if (empty($settings['your_setting_name'])) {
$error = 'invalid_value';
return false;
if (empty($settings['your_setting_name'])) {
$error = 'invalid_value';
return false;
}
}
}
}
When the bottom 3 options are empty (or any of the three for that matter), this will still save the options but give them value of "0" if they were empty when the option was saved. That's better than saving it without any value at all I suppose. Would much rather see the error on the field it's missing, I'm doing something wrong in this code because the error does not print out anywhere on the page, just saves and reloads. The good part is that I know now how to control these options and it's requirements to save and such, that hook you mentioned works just fine for my purposes btw, now it's just a matter of printing the error in the missing field(s). Anyone have any ideas? :erm: