Make WordPress Core

Ticket #5857: 5857.diff

File 5857.diff, 1.8 KB (added by andy, 18 years ago)
  • wp-includes/taxonomy.php

     
    10331033                $orderby = 't.slug';
    10341034        else if ( 'term_group' == $orderby )
    10351035                $orderby = 't.term_group';
     1036        else if ( 'term_order' == $orderby )
     1037                $orderby = 'tr.term_order';
    10361038        else
    10371039                $orderby = 't.term_id';
    10381040
     
    12491251                }
    12501252        }
    12511253
     1254        $t = get_taxonomy($taxonomy);
     1255        if ( ! $append && $t->sort ) {
     1256                $values = array();
     1257                $term_order = 0;
     1258                $final_term_ids = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids');
     1259                foreach ( $term_ids as $term_id )
     1260                        if ( in_array($term_id, $final_term_ids) )
     1261                                $values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $term_id, ++$term_order);
     1262                if ( $values )
     1263                        $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)");
     1264        }
     1265
    12521266        return $tt_ids;
    12531267}
    12541268
  • wp-includes/version.php

     
    1616 *
    1717 * @global int $wp_db_version
    1818 */
    19 $wp_db_version = 6825;
     19$wp_db_version = 6846;
    2020
    2121?>
  • wp-admin/includes/schema.php

     
    3131CREATE TABLE $wpdb->term_relationships (
    3232 object_id bigint(20) NOT NULL default 0,
    3333 term_taxonomy_id bigint(20) NOT NULL default 0,
     34 term_order int(11) NOT NULL default 0,
    3435 PRIMARY KEY  (object_id,term_taxonomy_id),
    3536 KEY term_taxonomy_id (term_taxonomy_id)
    3637) $charset_collate;