function page_content() { validate_message(); if (validate_option() == false) { include_once $GLOBALS['project_path'] . '/view/welcome.html'; } }
$any_changed = 0; // iterate through the list of options in this group // pull the vars from the post // validate ranges etc. // update the values $options = $wpdb->get_results("SELECT " . wp_table('options') . ".option_id, option_name, option_type, option_value, option_admin_level " . "FROM " . wp_table('options') . " " . "LEFT JOIN " . wp_table('optiongroup_options') . " ON " . wp_table('options') . ".option_id = " . wp_table('optiongroup_options') . ".option_id " . "WHERE group_id = {$option_group_id} " . "ORDER BY seq"); if ($options) { foreach ($options as $option) { // should we even bother checking? if ($user_level >= $option->option_admin_level) { $this_name = $option->option_name; $old_val = stripslashes($option->option_value); $new_val = $_POST[$this_name]; if ($new_val != $old_val) { // get type and validate $msg = validate_option($option, $this_name, $new_val); if ($msg == '') { //no error message $result = $wpdb->query("UPDATE " . wp_table('options') . " SET option_value = '{$new_val}' WHERE option_id = {$option->option_id}"); if (!$result) { $db_errors .= " SQL error while saving {$this_name}. "; } else { ++$any_changed; } } else { $validation_message .= $msg; } } } } // end foreach