Don't allow a category to be it's own parent. Props donncha. fixes #3278
git-svn-id: http://svn.automattic.com/wordpress/trunk@4490 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
172bfb801f
commit
2390613e37
|
@ -151,6 +151,9 @@ function wp_update_category($catarr) {
|
||||||
|
|
||||||
$cat_ID = (int) $catarr['cat_ID'];
|
$cat_ID = (int) $catarr['cat_ID'];
|
||||||
|
|
||||||
|
if( $cat_ID == $catarr['category_parent'] )
|
||||||
|
return false;
|
||||||
|
|
||||||
// First, get all of the original fields
|
// First, get all of the original fields
|
||||||
$category = get_category($cat_ID, ARRAY_A);
|
$category = get_category($cat_ID, ARRAY_A);
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,11 @@ case 'editedcat':
|
||||||
if ( !current_user_can('manage_categories') )
|
if ( !current_user_can('manage_categories') )
|
||||||
wp_die(__('Cheatin’ uh?'));
|
wp_die(__('Cheatin’ uh?'));
|
||||||
|
|
||||||
wp_update_category($_POST);
|
if ( wp_update_category($_POST) )
|
||||||
|
wp_redirect('categories.php?message=3');
|
||||||
|
else
|
||||||
|
wp_redirect('categories.php?message=5');
|
||||||
|
|
||||||
wp_redirect('categories.php?message=3');
|
|
||||||
exit;
|
exit;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -77,6 +79,7 @@ $messages[1] = __('Category added.');
|
||||||
$messages[2] = __('Category deleted.');
|
$messages[2] = __('Category deleted.');
|
||||||
$messages[3] = __('Category updated.');
|
$messages[3] = __('Category updated.');
|
||||||
$messages[4] = __('Category not added.');
|
$messages[4] = __('Category not added.');
|
||||||
|
$messages[5] = __('Category not updated.');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if (isset($_GET['message'])) : ?>
|
<?php if (isset($_GET['message'])) : ?>
|
||||||
|
|
Loading…
Reference in New Issue