Ticket #4099: bulk-edit-blogroll-cats-2.diff
| File bulk-edit-blogroll-cats-2.diff, 4.5 KB (added by technosailor, 5 years ago) |
|---|
-
Users/aaron/Sites/trunk/wp-admin/link-manager.php
116 116 <form id="links" method="post" action="link.php"> 117 117 <?php wp_nonce_field('bulk-bookmarks') ?> 118 118 <input type="hidden" name="link_id" value="" /> 119 <input type="hidden" name="action" value="" />119 <input type="hidden" id="action" name="action" value="bulkmodbookmarks" /> 120 120 <input type="hidden" name="order_by" value="<?php echo attribute_escape($order_by); ?>" /> 121 121 <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" /> 122 122 <table class="widefat"> … … 194 194 </table> 195 195 196 196 <div id="ajax-response"></div> 197 <h3><?php _e('Update Selected'); ?></h3> 198 <ul style="list-style:none;"> 199 <li><input type="radio" name="rbulkeditblogroll" id="dbookmarks" value="deletebookmarks" onclick="change_submit_button();" /> <label for="dbookmarks"><?php _e('Delete checked Bookmarks.'); ?></label></li> 200 <li> 201 <input type="radio" name="rbulkeditblogroll" id="ebookmarks" value="editbookmarks" onclick="change_submit_button();" checked="checked" /> <label for="ebookmarks"><?php _e('Set the new category for checked Blogroll items:'); ?></label> 202 203 <select name="bookmarks_newcat" onfocus="getElementById('ebookmarks').checked = 'true';getElementById('submiteditbookmarks').value = 'Update Checked Links';"> 204 <?php 205 $linkcats = get_categories("hide_empty=0"); 206 foreach($linkcats as $bulklinkcat) 207 echo'<option value="' . $bulklinkcat->cat_ID . '">' . $bulklinkcat->cat_name .'</option>'; 208 ?> 209 </select> 210 <script type="text/javascript" charset="utf-8"> 211 function change_submit_button () 212 { 213 if( document.getElementById('ebookmarks').checked == true) 214 { 215 document.getElementById('action').value = 'bulkmodbookmarks'; 216 } 217 else 218 { 219 document.getElementById('action').value = 'bulkdelbookmarks'; 220 document.getElementById('submiteditbookmarks').onclick = confirmDeleteLinks; 221 } 222 } 197 223 198 <p class="submit"><input type="submit" class="button" name="deletebookmarks" id="deletebookmarks" value="<?php _e('Delete Checked Links') ?> »" onclick="return confirm('<?php echo js_escape(__("You are about to delete these links permanently.\n'Cancel' to stop, 'OK' to delete.")); ?>')" /></p> 224 function confirmDeleteLinks() 225 { 226 return confirm("You are about to delete these links permanently.\n'Cancel' to stop, 'OK' to delete."); 227 } 228 </script> 229 </li> 230 </ul> 231 <p class="submit" style="width: 420px"> 232 <?php echo $referer; ?> 233 <input type="submit" name="submiteditbookmarks" id="submiteditbookmarks" value="<?php _e('Bulk Update'); ?>" /> 234 </p> 235 <p class="submit"> 199 236 </form> 200 201 237 <?php } ?> 202 238 203 239 </div> -
Users/aaron/Sites/trunk/wp-admin/link.php
1 1 <?php 2 2 require_once ('admin.php'); 3 3 echo'<pre>'; 4 print_r($_POST); 5 echo'</pre>'; 4 6 wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]')); 5 7 6 if (' ' != $_POST['deletebookmarks'])8 if ('bulkdelbookmarks' == $_POST['action']) 7 9 $action = 'deletebookmarks'; 8 if (' ' != $_POST['move'])10 if ('bulkmodbookmarks' == $_POST['action']) 9 11 $action = 'move'; 10 12 if ('' != $_POST['linkcheck']) 11 $linkcheck = $_POST[ linkcheck];13 $linkcheck = $_POST['linkcheck']; 12 14 13 15 $this_file = 'link-manager.php'; 14 16 … … 50 52 wp_redirect($this_file); 51 53 exit; 52 54 } 53 $all_links = join(',', $linkcheck); 54 // should now have an array of links we can change 55 //$q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)"); 56 55 //$link_count = count($linkcheck); 56 foreach($linkcheck as $link_id) 57 { 58 $link = get_link_to_edit( $link_id ); 59 60 $newlink['link_id'] = $link_id; 61 $newlink['link_url'] = clean_url($link->link_url); 62 $newlink['link_name'] = wp_specialchars( $link->link_name ); 63 $newlink['link_image'] = wp_specialchars( $link->link_image ); 64 $newlink['link_rss'] = clean_url($link->link_rss); 65 $newlink['link_category'] = array($_POST['bookmarks_newcat']); 66 wp_insert_link($newlink); 67 } 57 68 wp_redirect($this_file); 58 69 exit; 59 70 break;
