Show
Ignore:
Timestamp:
08/20/08 04:06:36 (3 months ago)
Author:
ryan
Message:

Merge crazyhorse management pages. see #7552

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/edit-link-categories.php

    r8656 r8682  
    1010require_once('admin.php'); 
    1111 
    12 // Handle bulk delete
    13 if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) { 
     12// Handle bulk action
     13if ( isset($_GET['action']) && isset($_GET['delete']) ) { 
    1414    check_admin_referer('bulk-link-categories'); 
    1515 
    1616    if ( !current_user_can('manage_categories') ) 
    1717        wp_die(__('Cheatin’ uh?')); 
     18     
     19    if ( $_GET['action'] == 'delete' ) { 
     20        foreach( (array) $_GET['delete'] as $cat_ID ) { 
     21            $cat_name = get_term_field('name', $cat_ID, 'link_category'); 
     22            $default_cat_id = get_option('default_link_category'); 
    1823 
    19     foreach( (array) $_GET['delete'] as $cat_ID ) { 
    20         $cat_name = get_term_field('name', $cat_ID, 'link_category'); 
    21         $default_cat_id = get_option('default_link_category'); 
     24           // Don't delete the default cats. 
     25           if ( $cat_ID == $default_cat_id ) 
     26               wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name)); 
    2227 
    23         // Don't delete the default cats. 
    24         if ( $cat_ID == $default_cat_id ) 
    25             wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name)); 
     28            wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id)); 
     29        } 
    2630 
    27         wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id)); 
     31        $location = 'edit-link-categories.php'; 
     32        if ( $referer = wp_get_referer() ) { 
     33            if ( false !== strpos($referer, 'edit-link-categories.php') ) 
     34                $location = $referer; 
     35        } 
     36 
     37        $location = add_query_arg('message', 6, $location); 
     38        wp_redirect($location); 
     39        exit(); 
    2840    } 
    29  
    30     $location = 'edit-link-categories.php'; 
    31     if ( $referer = wp_get_referer() ) { 
    32         if ( false !== strpos($referer, 'edit-link-categories.php') ) 
    33             $location = $referer; 
    34     } 
    35  
    36     $location = add_query_arg('message', 6, $location); 
    37     wp_redirect($location); 
    38     exit(); 
    3941} elseif ( !empty($_GET['_wp_http_referer']) ) { 
    4042     wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']))); 
     
    4345 
    4446$title = __('Link Categories'); 
    45 $parent_file = 'edit.php'; 
    4647 
    4748wp_enqueue_script( 'admin-categories' ); 
     
    6566 
    6667<form id="posts-filter" action="" method="get"> 
    67 <?php if ( current_user_can('manage_categories') ) : ?> 
    68     <h2><?php printf(__('Manage Link Categories (<a href="%s">add new</a>)'), '#addcat') ?> </h2> 
    69 <?php else : ?> 
    70     <h2><?php _e('Manage Link Categories') ?> </h2> 
    71 <?php endif; ?> 
     68    <h2><?php printf( current_user_can('manage_categories') ? __('Link Categories (<a href="%s">Add New</a>)') : __('Manage Tags'), '#addcat' ); ?></h2> 
    7269 
    7370<p id="post-search"> 
     
    10097 
    10198<div class="alignleft"> 
    102 <input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" /> 
     99<select name="action"> 
     100<option value="" selected><?php _e('Actions'); ?></option> 
     101<option value="delete"><?php _e('Delete'); ?></option> 
     102</select> 
     103<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" /> 
    103104<?php wp_nonce_field('bulk-link-categories'); ?> 
    104105</div>