Permalink
Browse files

Prevent default collection deletion.

Although a check was in place for deleting a singular default
Collection it was still possible to remove the default Collection via
bulk deletion.
  • Loading branch information...
1 parent 8265957 commit 3bb4b6b6f92de14794edfc65dc882b2ac450376f Michael Sisk committed Sep 25, 2011
Showing with 8 additions and 3 deletions.
  1. +8 −3 webcomic-includes/admin.php
@@ -651,10 +651,15 @@ public function hook_admin_init() {
} elseif ( 'delete' == $action ) {
$i = 0;
- foreach ( $_REQUEST[ 'bulk' ] as $bulk )
- if ( $old_term = get_term( $bulk, $type ) )
- if ( !is_wp_error( $deleted = wp_delete_term( $bulk, $_REQUEST[ 'page' ] ) ) )
+ foreach ( $_REQUEST[ 'bulk' ] as $bulk ) {
+ if ( $old_term = get_term( $bulk, "webcomic_$type" ) ) {
+ if ( $old_term->webcomic_default ) {
+ continue;
+ } else if ( !is_wp_error( $deleted = wp_delete_term( $bulk, $_REQUEST[ 'page' ] ) ) ) {
$i++;
+ }
+ }
+ }
if ( $i )
$this->update[ 'deleted_term' ] = sprintf( _n( '%d term deleted', '%d terms deleted', $i, 'webcomic' ), $i );

0 comments on commit 3bb4b6b

Please sign in to comment.