Make WordPress Core

Ticket #5240: taxonomy_diffs

File taxonomy_diffs, 2.0 KB (added by michelwp, 17 years ago)
Line 
1--- taxonomy_o.php      2007-09-23 00:36:00.000000000 +0200
2+++ taxonomy.php        2007-10-21 11:50:28.000000000 +0200
3@@ -926,6 +926,7 @@
4                $slug = sanitize_title($name);
5-
6+       
7        $term_group = 0;
8        if ( $alias_of ) {
9-               $alias = $wpdb->fetch_row("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = '$alias_of'");
10+               /*fetch_row*/
11+               $alias = $wpdb->get_row("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = '$alias_of'");
12                if ( $alias->term_group ) {
13@@ -933,6 +934,10 @@
14                        $term_group = $alias->term_group;
15+                       
16                } else {
17-                       // The alias isn't in a group, so let's create a new one and firstly add the alias term to it.
18-                       $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms GROUP BY term_group") + 1;
19+                       //echo $alias_of.' o-oo '.$alias->term_group;
20+                       //  GROUP BY term_group The alias isn't in a group, so let's create a new one and firstly add the alias term to it.
21+                       $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1;
22+                       
23                        $wpdb->query("UPDATE $wpdb->terms SET term_group = $term_group WHERE term_id = $alias->term_id");
24+               
25                }
26@@ -1093,4 +1098,6 @@
27        if ( $alias_of ) {
28-               $alias = $wpdb->fetch_row("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = '$alias_of'");
29+               /*get_row*/
30+               $alias = $wpdb->get_row("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = '$alias_of'");
31                if ( $alias->term_group ) {
32+                       
33                        // The alias we want is already in a group, so let's use that one.
34@@ -1098,4 +1105,5 @@
35                } else {
36-                       // The alias isn't in a group, so let's create a new one and firstly add the alias term to it.
37-                       $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms GROUP BY term_group") + 1;
38+                       
39+                       // GROUP BY term_group - The alias isn't in a group, so let's create a new one and firstly add the alias term to it.
40+                       $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1;
41                        $wpdb->query("UPDATE $wpdb->terms SET term_group = $term_group WHERE term_id = $alias->term_id");