diff --git a/wp-admin/categories.php b/wp-admin/categories.php index b38443774..b4d8165ba 100644 --- a/wp-admin/categories.php +++ b/wp-admin/categories.php @@ -23,20 +23,19 @@ for ($i=0; $iget_var("SELECT cat_ID FROM $wpdb->categories ORDER BY cat_ID DESC LIMIT 1") + 1; - $category_nicename = sanitize_title($cat_name, $cat_ID); - $category_description = $_POST['category_description']; - $cat = intval($_POST['cat']); - - $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$cat')"); - - header('Location: categories.php?message=1#addcat'); - + if ($user_level < 3) + die (__('Cheatin’ uh?')); + + $cat_name= $_POST['cat_name']; + $id_result = $wpdb->get_row("SHOW TABLE STATUS LIKE '$wpdb->categories'"); + $cat_ID = $id_result->Auto_increment; + $category_nicename = sanitize_title($cat_name, $cat_ID); + $category_description = $_POST['category_description']; + $cat = intval($_POST['cat']); + + $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$cat')"); + + header('Location: categories.php?message=1#addcat'); break; case 'Delete': @@ -71,43 +70,51 @@ case 'edit': ?>
-

-
- - -


-

-


- -

- -


-

-

-
+

+
+ + + + + + + + + + + + + + + + + +
+
+
+

+
+

- query("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$cat' WHERE cat_ID = '$cat_ID'"); - if ($user_level < 3) - die (__('Cheatin’ uh?')); - - $cat_name = $_POST['cat_name']; - $cat_ID = (int) $_POST['cat_ID']; - $category_nicename = sanitize_title($cat_name, $cat_ID); - $category_description = $_POST['category_description']; - - $wpdb->query("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$cat' WHERE cat_ID = '$cat_ID'"); - - header('Location: categories.php?message=3'); - + header('Location: categories.php?message=3'); break; default: