Make WordPress Core


Ignore:
Timestamp:
01/11/2010 09:49:40 PM (12 years ago)
Author:
wpmuguru
Message:

merge in multisite login, wp-includes, See #11644

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/taxonomy.php

    r12693 r12697  
    14181418
    14191419    if ( ! $term_id = is_term($slug) ) {
    1420         if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
    1421             return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
    1422         $term_id = (int) $wpdb->insert_id;
     1420                if ( !is_multisite() ) {
     1421                        if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
     1422                                return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
     1423                        $term_id = (int) $wpdb->insert_id;
     1424                } else {
     1425                    $maxterm = $wpdb->get_var( "SELECT max(term_id) FROM {$wpdb->terms}" );
     1426                        $term_id = mt_rand( $maxterm+100, $maxterm+4000 );
     1427                        if ( false === $wpdb->insert( $wpdb->terms, compact( 'term_id', 'name', 'slug', 'term_group' ) ) )
     1428                                return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
     1429                }
    14231430    } else if ( is_taxonomy_hierarchical($taxonomy) && !empty($parent) ) {
    14241431        // If the taxonomy supports hierarchy and the term has a parent, make the slug unique
    14251432        // by incorporating parent slugs.
    1426         $slug = wp_unique_term_slug($slug, (object) $args);
    1427         if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
    1428             return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
    1429         $term_id = (int) $wpdb->insert_id;
     1433                $slug = wp_unique_term_slug($slug, (object) $args);
     1434                if( !is_multisite() ) {
     1435                        if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
     1436                                return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
     1437                        $term_id = (int) $wpdb->insert_id;
     1438                } else {
     1439                        $maxterm = $wpdb->get_var( "SELECT max(term_id) FROM {$wpdb->terms}" );
     1440                        $term_id = mt_rand( $maxterm+100, $maxterm+4000 );
     1441                        if ( false === $wpdb->insert( $wpdb->terms, compact( 'term_id','name', 'slug', 'term_group' ) ) )
     1442                                return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
     1443                }
    14301444    }
    14311445
Note: See TracChangeset for help on using the changeset viewer.