From 391e53ed8466d2c43f4bab2f8be5609f81df39d4 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 31 May 2004 15:43:45 +0000 Subject: [PATCH] Add default_email_category. Make default category and default email category provisionable via options writing. Credit: Kitten. git-svn-id: https://develop.svn.wordpress.org/trunk@1370 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/options-writing.php | 23 ++++++++++++++++++----- wp-admin/upgrade-functions.php | 9 +++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/wp-admin/options-writing.php b/wp-admin/options-writing.php index 49bcf4c865..fdb3a711f7 100644 --- a/wp-admin/options-writing.php +++ b/wp-admin/options-writing.php @@ -48,7 +48,7 @@ include('options-head.php');

Writing Options

- + @@ -74,6 +74,19 @@ include('options-head.php'); /> + + + +
@@ -104,12 +117,12 @@ include('options-head.php'); - - get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name"); +//Alreay have $categories from default_category foreach ($categories as $category) : -if ($category->cat_ID == get_settings('default_category')) $selected = " selected='selected'"; +if ($category->cat_ID == get_settings('default_email_category')) $selected = " selected='selected'"; else $selected = ''; echo "\n\t"; endforeach; diff --git a/wp-admin/upgrade-functions.php b/wp-admin/upgrade-functions.php index d17b332456..ed7f228a5d 100644 --- a/wp-admin/upgrade-functions.php +++ b/wp-admin/upgrade-functions.php @@ -7,6 +7,7 @@ function upgrade_all() { upgrade_100(); upgrade_101(); upgrade_110(); + upgrade_130(); } // General @@ -834,4 +835,12 @@ function upgrade_110() { $wpdb->query("ALTER TABLE `$wpdb->comments` CHANGE `comment_author_url` `comment_author_url` VARCHAR( 200 ) NOT NULL"); } +function upgrade_130() { + global $wpdb; + + if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'default_email_category'")) { + $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_description, option_admin_level) VALUES('default_email_category', 1, '1', 'by default posts by email will have this category', 8)"); + } +} + ?> \ No newline at end of file