WordPress.org

Make WordPress Core

Changeset 12699


Ignore:
Timestamp:
01/11/2010 10:23:58 PM (11 years ago)
Author:
ryan
Message:

Mainstream things that don't need to be multisite only. Formatting cleanups. see #11644

Location:
trunk/wp-includes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/author-template.php

    r12697 r12699  
    270270
    271271    /** @todo Move select to get_authors(). */
    272         if( is_multisite() ) {
    273                 $users = get_users_of_blog();
    274                 $author_ids = array();
    275                 foreach ( (array) $users as $user ) {
    276                         $author_ids[] = $user->user_id;
    277                 }
    278                 if ( count($author_ids) > 0  ) {
    279                         $author_ids=implode(',', $author_ids );
    280                         $authors = $wpdb->get_results( "SELECT ID, user_nicename from $wpdb->users WHERE ID IN($author_ids) " . ($exclude_admin ? "AND user_login <> 'admin' " : '') . "ORDER BY display_name" );
    281                 } else {
    282                         $authors = array();
    283                 }
    284         } else {
    285                 $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name");
    286         }
     272    $users = get_users_of_blog();
     273    $author_ids = array();
     274    foreach ( (array) $users as $user )
     275        $author_ids[] = $user->user_id;
     276    if ( count($author_ids) > 0  ) {
     277        $author_ids = implode(',', $author_ids );
     278        $authors = $wpdb->get_results( "SELECT ID, user_nicename from $wpdb->users WHERE ID IN($author_ids) " . ($exclude_admin ? "AND user_login <> 'admin' " : '') . "ORDER BY display_name" );
     279    } else {
     280        $authors = array();
     281    }
    287282
    288283    $author_count = array();
    289     foreach ((array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author") as $row) {
     284    foreach ( (array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author") as $row )
    290285        $author_count[$row->post_author] = $row->count;
    291     }
    292286
    293287    foreach ( (array) $authors as $author ) {
  • trunk/wp-includes/capabilities.php

    r12697 r12699  
    988988    $current_user = wp_get_current_user();
    989989
    990         if( is_multisite() && is_super_admin() )
    991                 return true;
     990    if ( is_multisite() && is_super_admin() )
     991        return true;
    992992
    993993    if ( empty( $current_user ) )
  • trunk/wp-includes/taxonomy.php

    r12697 r12699  
    14181418
    14191419    if ( ! $term_id = is_term($slug) ) {
    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                 }
     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        }
    14301430    } else if ( is_taxonomy_hierarchical($taxonomy) && !empty($parent) ) {
    14311431        // If the taxonomy supports hierarchy and the term has a parent, make the slug unique
    14321432        // by incorporating parent slugs.
    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                 }
     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        }
    14441444    }
    14451445
  • trunk/wp-includes/user.php

    r12697 r12699  
    280280    if ( empty($id) )
    281281        $id = (int) $blog_id;
    282         $blog_prefix = $wpdb->get_blog_prefix($id);
     282    $blog_prefix = $wpdb->get_blog_prefix($id);
    283283    $users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" );
    284284    return $users;
Note: See TracChangeset for help on using the changeset viewer.