WordPress.org

Make WordPress Core

Changeset 5560


Ignore:
Timestamp:
05/27/2007 05:21:04 PM (15 years ago)
Author:
ryan
Message:

Link category fixes. see #4189

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/bookmark.php

    r5556 r5560  
    5454function wp_get_link_cats($link_id = 0) {
    5555
    56     $cats = get_object_terms($link_id, 'link_category', 'get=ids');
     56    $cats = get_object_terms($link_id, 'link_category', 'fields=ids');
    5757
    5858    return array_unique($cats);
  • trunk/wp-includes/bookmark-template.php

    r5530 r5560  
    334334    if ( $categorize ) {
    335335        //Split the bookmarks into ul's for each category
    336         $cats = get_categories("type=link&category_name=$category_name&include=$category&orderby=$category_orderby&order=$category_order&hierarchical=0");
     336        $cats = get_terms('link_category', "category_name=$category_name&include=$category&orderby=$category_orderby&order=$category_order&hierarchical=0");
    337337
    338338        foreach ( (array) $cats as $cat ) {
  • trunk/wp-includes/bookmark.php

    r5444 r5560  
    7777
    7878    if ( ! empty($category_name) ) {
    79         if ( $cat_id = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$category_name' LIMIT 1") )
    80             $category = $cat_id;
     79        if ( $category = get_term_by('name', $category_name, 'link_category') );
     80            $category = $category->term_id;
    8181    }
    8282
     
    8888            foreach ( $incategories as $incat ) {
    8989                if (empty($category_query))
    90                     $category_query = ' AND ( category_id = ' . intval($incat) . ' ';
     90                    $category_query = ' AND ( tt.term_id = ' . intval($incat) . ' ';
    9191                else
    92                     $category_query .= ' OR category_id = ' . intval($incat) . ' ';
     92                    $category_query .= ' OR tt.term_id = ' . intval($incat) . ' ';
    9393            }
    9494        }
    9595    }
    9696    if (!empty($category_query)) {
    97         $category_query .= ')';
    98         $join = " LEFT JOIN $wpdb->link2cat ON ($wpdb->links.link_id = $wpdb->link2cat.link_id) ";
     97        $category_query .= ") AND taxonomy = 'link_category'";
     98        $join = " LEFT JOIN $wpdb->term_relationships AS tr ON ($wpdb->links.link_id = tr.object_id) LEFT JOIN $wpdb->term_taxonomy as tt ON tt.term_taxonomy_id = tr.term_taxonomy_id";
    9999    }
    100100
  • trunk/wp-includes/category.php

    r5555 r5560  
    1414function &get_categories($args = '') {
    1515    // TODO Add back compat fields into each object.
     16    // Set taxonomy to link_category if type=link
    1617    return get_terms('category', $args);
    1718}
  • trunk/wp-includes/taxonomy.php

    r5559 r5560  
    243243
    244244function wp_update_term_count( $terms, $taxonomy ) {
     245    global $wpdb;
     246
    245247    if ( empty($terms) )
    246248        return false;
Note: See TracChangeset for help on using the changeset viewer.