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
This commit is contained in:
parent
7e646da0fc
commit
391e53ed84
@ -48,7 +48,7 @@ include('options-head.php');
|
||||
<h2>Writing Options</h2>
|
||||
<form name="form1" method="post" action="options.php">
|
||||
<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">
|
||||
<tr valign="top">
|
||||
<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')); ?> />
|
||||
<?php _e('WordPress should correct invalidly nested XHTML automatically') ?></label></td>
|
||||
</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>
|
||||
<fieldset class="options">
|
||||
<legend><?php _e('Update Services') ?></legend>
|
||||
@ -104,12 +117,12 @@ include('options-head.php');
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Usual category:') ?></th>
|
||||
<td><select name="default_category" id="default_category">
|
||||
<th scope="row"><?php _e('Default post by mail category:') ?></th>
|
||||
<td><select name="default_email_category" id="default_email_category">
|
||||
<?php
|
||||
$categories = $wpdb->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<option value='$category->cat_ID' $selected>$category->cat_name</option>";
|
||||
endforeach;
|
||||
|
@ -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)");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user