Changeset 4495 for trunk/wp-admin/admin-db.php
- Timestamp:
- 11/19/2006 07:56:05 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-db.php
r4490 r4495 49 49 if ( $user->has_cap('edit_posts') || $exclude_zeros == false ) 50 50 return array($user->id); 51 else 51 else 52 52 return false; 53 53 } … … 97 97 98 98 $cat_name = apply_filters('pre_category_name', $cat_name); 99 99 100 100 if (empty ($category_nicename)) 101 101 $category_nicename = sanitize_title($cat_name); … … 199 199 else 200 200 $cats = array_diff($cats, array($cat_ID)); 201 wp_set_post_categories($post_id, $cats); 201 wp_set_post_categories($post_id, $cats); 202 202 } 203 203 … … 210 210 else 211 211 $cats = array_diff($cats, array($cat_ID)); 212 wp_set_link_cats($link_id, $cats); 213 } 214 212 wp_set_link_cats($link_id, $cats); 213 } 214 215 215 wp_cache_delete($cat_ID, 'category'); 216 216 wp_cache_delete('all_category_ids', 'category'); … … 286 286 function wp_revoke_user($id) { 287 287 $id = (int) $id; 288 288 289 289 $user = new WP_User($id); 290 $user->remove_all_caps(); 290 $user->remove_all_caps(); 291 291 } 292 292 … … 386 386 387 387 // Passed link category list overwrites existing category list if not empty. 388 388 if ( isset($linkdata['link_category']) && is_array($linkdata['link_category']) 389 389 && 0 != count($linkdata['link_category']) ) 390 391 else 392 390 $link_cats = $linkdata['link_category']; 391 else 392 $link_cats = $link['link_category']; 393 393 394 394 // Merge old and new fields with new fields overwriting old ones. 395 395 $linkdata = array_merge($link, $linkdata); 396 396 $linkdata['link_category'] = $link_cats; 397 397 398 398 return wp_insert_link($linkdata); … … 403 403 404 404 do_action('delete_link', $link_id); 405 405 406 406 $categories = wp_get_link_cats($link_id); 407 407 if( is_array( $categories ) ) { … … 419 419 global $wpdb; 420 420 421 $sql = "SELECT category_id 422 FROM $wpdb->link2cat 423 WHERE link_id = $link_ID 421 $sql = "SELECT category_id 422 FROM $wpdb->link2cat 423 WHERE link_id = $link_ID 424 424 ORDER BY category_id"; 425 425 … … 442 442 // First the old categories 443 443 $old_categories = $wpdb->get_col(" 444 SELECT category_id 445 FROM $wpdb->link2cat 444 SELECT category_id 445 FROM $wpdb->link2cat 446 446 WHERE link_id = $link_ID"); 447 447 … … 458 458 foreach ($delete_cats as $del) { 459 459 $wpdb->query(" 460 DELETE FROM $wpdb->link2cat 461 WHERE category_id = $del 462 AND link_id = $link_ID 460 DELETE FROM $wpdb->link2cat 461 WHERE category_id = $del 462 AND link_id = $link_ID 463 463 "); 464 464 } … … 471 471 foreach ($add_cats as $new_cat) { 472 472 $wpdb->query(" 473 INSERT INTO $wpdb->link2cat (link_id, category_id) 473 INSERT INTO $wpdb->link2cat (link_id, category_id) 474 474 VALUES ($link_ID, $new_cat)"); 475 475 } 476 476 } 477 477 478 478 // Update category counts. 479 479 $all_affected_cats = array_unique(array_merge($link_categories, $old_categories));
Note: See TracChangeset
for help on using the changeset viewer.