[wp-cvs] wordpress/wp-admin options-writing.php, 1.17, 1.18 upgrade-functions.php, 1.56, 1.57

Ryan Boren rboren at users.sourceforge.net
Mon May 31 10:43:48 CDT 2004


Update of /cvsroot/cafelog/wordpress/wp-admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27067

Modified Files:
	options-writing.php upgrade-functions.php 
Log Message:
Add default_email_category.  Make default category and default email category provisionable via options writing.  Credit:  Kitten.

Index: options-writing.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/options-writing.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** options-writing.php	24 May 2004 08:22:17 -0000	1.17
--- options-writing.php	31 May 2004 15:43:45 -0000	1.18
***************
*** 49,53 ****
    <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'" /> 
      <table width="100%" cellspacing="2" cellpadding="5" class="editform"> 
        <tr valign="top">
--- 49,53 ----
    <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', 'default_email_category'" /> 
      <table width="100%" cellspacing="2" cellpadding="5" class="editform"> 
        <tr valign="top">
***************
*** 75,78 ****
--- 75,91 ----
            <?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">
***************
*** 105,114 ****
         		</tr>
          	<tr valign="top">
!                 <th scope="row"><?php _e('Usual 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>";
--- 118,127 ----
         		</tr>
          	<tr valign="top">
!                 <th scope="row"><?php _e('Default post by mail category:') ?></th>
!         		<td><select name="default_email_category" id="default_email_category">
  <?php
! //Alreay have $categories from default_category
  foreach ($categories as $category) :
! 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>";

Index: upgrade-functions.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/upgrade-functions.php,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** upgrade-functions.php	24 May 2004 18:10:32 -0000	1.56
--- upgrade-functions.php	31 May 2004 15:43:45 -0000	1.57
***************
*** 8,11 ****
--- 8,12 ----
  	upgrade_101();
  	upgrade_110();
+ 	upgrade_130();
  }
  
***************
*** 835,837 ****
--- 836,846 ----
  }
  
+ 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




More information about the cvs mailing list