WordPress.org

Make WordPress Core

Changeset 6842


Ignore:
Timestamp:
02/14/2008 05:28:48 AM (12 years ago)
Author:
ryan
Message:

Bulk delete for links

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/link-manager.php

    r6804 r6842  
    11<?php
    2 
    3 
    4 // Links
    5 // Copyright (C) 2002, 2003 Mike Little -- mike@zed1.com
    62
    73require_once ('admin.php');
     4
     5// Handle bulk deletes
     6if ( isset($_GET['deleteit']) && isset($_GET['linkcheck']) ) {
     7    check_admin_referer('bulk-bookmarks');
     8
     9    if ( ! current_user_can('manage_links') )
     10        wp_die( __('You do not have sufficient permissions to edit the links for this blog.') );
     11
     12    foreach ( (array) $_GET['linkcheck'] as $link_id) {
     13        $link_id = (int) $link_id;
     14
     15        wp_delete_link($link_id);
     16    }
     17
     18    $sendback = wp_get_referer();
     19    $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
     20    wp_redirect($sendback);
     21    exit;
     22}
    823
    924wp_enqueue_script( 'wp-lists' );
     
    7287
    7388<div style="float: left">
    74 <input type="button" value="<?php _e('Delete'); ?>" name="deleteit" />
    75 
     89<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" />
     90<?php wp_nonce_field('bulk-posts'); ?>
    7691<?php
    7792$categories = get_terms('link_category', "hide_empty=1");
     
    99114<br style="clear:both;" />
    100115</div>
    101 </form>
    102116
    103117<br style="clear:both;" />
     
    124138?>
    125139
    126 <form id="links" method="post" action="link.php">
    127140<?php wp_nonce_field('bulk-bookmarks') ?>
    128141<input type="hidden" name="link_id" value="" />
     
    133146    <thead>
    134147    <tr>
    135     <th style="text-align: center"><input type="checkbox" onclick="checkAll(document.getElementById('links'));" /></th>
     148    <th style="text-align: center"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
    136149<?php foreach($link_columns as $column_display_name) {
    137150    echo $column_display_name;
     
    201214    </tbody>
    202215</table>
     216</form>
    203217
    204218<div id="ajax-response"></div>
Note: See TracChangeset for help on using the changeset viewer.