Ticket #923: link-manager.php.diff

File link-manager.php.diff, 1.6 kB (added by tivac, 3 years ago)

Adds multiple link deletion

  • link-manager.php

    old new  
    6666if ('' != $_POST['assign']) $action = 'assign'; 
    6767if ('' != $_POST['visibility']) $action = 'visibility'; 
    6868if ('' != $_POST['move']) $action = 'move'; 
     69if ('' != $_POST['bulkdelete']) $action = 'bulkdelete'; 
    6970if ('' != $_POST['linkcheck']) $linkcheck = $_POST[linkcheck]; 
    7071 
    7172switch ($action) { 
     
    270271    wp_redirect($this_file); 
    271272    break; 
    272273  } // end Delete 
     274   
     275  case 'bulkdelete': { 
     276        check_admin_referer(); 
     277           
     278        if($user_level < 5) 
     279                die(__("You're not qualified to swim here")); 
     280         
     281        // let's clean this up a bit, just to be safe 
     282        foreach($_POST['linkcheck'] as $link_id) { 
     283                $links[] = (int) $link_id; 
     284        } 
     285         
     286        $wpdb->query("DELETE FROM $wpdb->links WHERE (link_id = ".implode(" OR link_id = ", $links).")"); 
     287         
     288        wp_redirect($this_file); 
     289         
     290        break; 
     291  } // end bulkdelete 
    273292 
    274293  case 'linkedit': { 
    275294        $xfn = true; 
     
    733752        <td> 
    734753          <?php _e('Move to category:'); category_dropdown('category'); ?> <input name="move" type="submit" id="move" value="<?php _e('Go') ?>" /> 
    735754        </td> 
     755        <td> 
     756          <input name="bulkdelete" type="submit" id="bulkdelete" value="<?php _e('Delete Selected') ?>" onclick="return confirm('You are about to delete all selected links.\n  \'Cancel\' to stop, \'OK\' to delete.');"/> 
     757        </td> 
    736758        <td align="right"> 
    737759          <a href="#" onclick="checkAll(document.getElementById('links')); return false; "><?php _e('Toggle Checkboxes') ?></a> 
    738760        </td>