Add default_email_category. Make default category and default email category provisionable via options writing. Credit: Kitten.
git-svn-id: http://svn.automattic.com/wordpress/trunk@1370 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
45745f1bd0
commit
9275cb270d
|
@ -48,7 +48,7 @@ include('options-head.php');
|
||||||
<h2>Writing Options</h2>
|
<h2>Writing Options</h2>
|
||||||
<form name="form1" method="post" action="options.php">
|
<form name="form1" method="post" action="options.php">
|
||||||
<input type="hidden" name="action" value="update" />
|
<input type="hidden" name="action" value="update" />
|
||||||
<input type="hidden" name="page_options" value="'default_post_edit_rows','use_smilies','use_balanceTags','advanced_edit','ping_sites','mailserver_url', 'mailserver_port','mailserver_login','mailserver_pass','default_category'" />
|
<input type="hidden" name="page_options" value="'default_post_edit_rows','use_smilies','use_balanceTags','advanced_edit','ping_sites','mailserver_url', 'mailserver_port','mailserver_login','mailserver_pass','default_category', 'default_email_category'" />
|
||||||
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
|
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<th scope="row"> <?php _e('When starting a post, show:') ?> </th>
|
<th scope="row"> <?php _e('When starting a post, show:') ?> </th>
|
||||||
|
@ -74,6 +74,19 @@ include('options-head.php');
|
||||||
<input name="use_balanceTags" type="checkbox" id="label2" value="1" <?php checked('1', get_settings('use_balanceTags')); ?> />
|
<input name="use_balanceTags" type="checkbox" id="label2" value="1" <?php checked('1', get_settings('use_balanceTags')); ?> />
|
||||||
<?php _e('WordPress should correct invalidly nested XHTML automatically') ?></label></td>
|
<?php _e('WordPress should correct invalidly nested XHTML automatically') ?></label></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr valign="top">
|
||||||
|
<th scope="row"><?php _e('Default post category:') ?></th>
|
||||||
|
<td><select name="default_category" id="default_category">
|
||||||
|
<?php
|
||||||
|
$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name");
|
||||||
|
foreach ($categories as $category) :
|
||||||
|
if ($category->cat_ID == get_settings('default_category')) $selected = " selected='selected'";
|
||||||
|
else $selected = '';
|
||||||
|
echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>";
|
||||||
|
endforeach;
|
||||||
|
?>
|
||||||
|
</select></td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<fieldset class="options">
|
<fieldset class="options">
|
||||||
<legend><?php _e('Update Services') ?></legend>
|
<legend><?php _e('Update Services') ?></legend>
|
||||||
|
@ -104,12 +117,12 @@ include('options-head.php');
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<th scope="row"><?php _e('Usual category:') ?></th>
|
<th scope="row"><?php _e('Default post by mail category:') ?></th>
|
||||||
<td><select name="default_category" id="default_category">
|
<td><select name="default_email_category" id="default_email_category">
|
||||||
<?php
|
<?php
|
||||||
$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name");
|
//Alreay have $categories from default_category
|
||||||
foreach ($categories as $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 = '';
|
else $selected = '';
|
||||||
echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>";
|
echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>";
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
|
@ -7,6 +7,7 @@ function upgrade_all() {
|
||||||
upgrade_100();
|
upgrade_100();
|
||||||
upgrade_101();
|
upgrade_101();
|
||||||
upgrade_110();
|
upgrade_110();
|
||||||
|
upgrade_130();
|
||||||
}
|
}
|
||||||
|
|
||||||
// General
|
// 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");
|
$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)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue