Ticket #4015: cat_scope.diff
| File cat_scope.diff, 5.0 kB (added by Tjworld, 1 year ago) |
|---|
-
wordpress-2.1.3/wp-admin/admin-db.php
old new 111 111 if ( empty($category_parent) || !get_category( $category_parent ) || ($cat_ID && cat_is_ancestor_of($cat_ID, $category_parent) ) ) 112 112 $category_parent = 0; 113 113 114 if ( isset($cat_scope) ) // *** Patch Category Scope *** 115 $cat_scope = (int) $cat_scope; 116 else 117 $cat_scope = 0; // *** Patch End *** 118 114 119 if ( isset($posts_private) ) 115 120 $posts_private = (int) $posts_private; 116 121 else … … 121 126 else 122 127 $links_private = 0; 123 128 124 if (!$update) { 125 $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent, links_private, posts_private ) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$category_parent', '$links_private', '$posts_private')");129 if (!$update) { // *** Patch Category Scope *** 130 $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent, links_private, posts_private, cat_scope) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$category_parent', '$links_private', '$posts_private', '$cat_scope')"); 126 131 $cat_ID = (int) $wpdb->insert_id; 127 132 } else { 128 $wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent', links_private = '$links_private', posts_private = '$posts_private' WHERE cat_ID = '$cat_ID'");129 } 133 $wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent', links_private = '$links_private', posts_private = '$posts_private', cat_scope = '$cat_scope' WHERE cat_ID = '$cat_ID'"); 134 } // *** Patch End *** 130 135 131 136 if ( $category_nicename == '' ) { 132 137 $category_nicename = sanitize_title($cat_name, $cat_ID ); -
wordpress-2.1.3/wp-admin/admin-functions.php
old new 634 634 } 635 635 636 636 function return_categories_list( $parent = 0 ) { 637 global $wpdb; 638 return $wpdb->get_col( "SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent AND ( link_count = 0 OR category_count != 0 OR ( link_count = 0 AND category_count = 0 ) ) ORDER BY category_count DESC" ); 637 global $wpdb; 638 // *** Patch Category Scope *** 639 return $wpdb->get_col( "SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent AND (cat_scope = 0 OR cat_scope = 1) ORDER BY category_count DESC" ); 640 // *** Patch End *** 639 641 } 640 642 641 643 function sort_cats( $cat1, $cat2 ) { … … 709 711 710 712 function return_link_categories_list( $parent = 0 ) { 711 713 global $wpdb; 712 return $wpdb->get_col( "SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent AND ( category_count = 0 OR link_count != 0 OR ( link_count = 0 AND category_count = 0 ) ) ORDER BY link_count DESC" ); 714 // *** Patch Category Scope *** 715 return $wpdb->get_col( "SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent AND (cat_scope = 0 OR cat_scope = 2) ORDER BY link_count DESC" ); 716 // *** Patch End 713 717 } 714 718 715 719 function get_nested_link_categories( $default = 0, $parent = 0 ) { -
wordpress-2.1.3/wp-admin/edit-category-form.php
old new 33 33 <td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo attribute_escape($category->category_nicename); ?>" size="40" /></td> 34 34 </tr> 35 35 <tr> 36 <th scope="row" valign="top"><label for="cat_scope"><?php _e('Category scope:') ?></label></th> 37 <td> 38 <label for="cat_scope-0"><input id="cat_scope-0" name="cat_scope" type="radio" value="0" <?php checked($category->cat_scope, '0'); ?> /> <?php _e('Both') ?></label> 39 <label for="cat_scope-1"><input id="cat_scope-1" name="cat_scope" type="radio" value="1" <?php checked($category->cat_scope, '1'); ?> /> <?php _e('Post') ?></label> 40 <label for="cat_scope-2"><input id="cat_scope-2" name="cat_scope" type="radio" value="2" <?php checked($category->cat_scope, '2'); ?> /> <?php _e('Link') ?></label> 41 </td> 42 </tr> 43 <tr> 36 44 <th scope="row" valign="top"><label for="category_parent"><?php _e('Category parent:') ?></label></th> 37 45 <td> 38 46 <?php wp_dropdown_categories('hide_empty=0&name=category_parent&selected=' . $category->category_parent . '&hierarchical=1&show_option_none=' . __('None')); ?>
