WordPress.org

Make WordPress Core

Changeset 12807


Ignore:
Timestamp:
01/22/2010 11:51:23 PM (10 years ago)
Author:
wpmuguru
Message:

Change get_blogs_of_user to include 3.0 main site, Fixes #11975

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/ms-functions.php

    r12806 r12807  
    470470    $blogs = $match = array();
    471471    foreach ( (array) $user as $key => $value ) {
    472         if ( false !== strpos( $key, '_capabilities') && 0 === strpos( $key, $wpdb->base_prefix ) && preg_match( '/' . $wpdb->base_prefix . '(\d+)_capabilities/', $key, $match ) ) {
    473             $blog = get_blog_details( $match[1] );
     472        if ( false !== strpos( $key, '_capabilities') && 0 === strpos( $key, $wpdb->base_prefix ) && preg_match( '/' . $wpdb->base_prefix . '((\d+)_)?capabilities/', $key, $match ) ) {
     473            if ( count( $match ) > 2 )
     474                $blog_id = $match[ 2 ];
     475            else
     476                $blog_id = 1;
     477            $blog = get_blog_details( $blog_id );
    474478            if ( $blog && isset( $blog->domain ) && ( $all == true || $all == false && ( $blog->archived == 0 && $blog->spam == 0 && $blog->deleted == 0 ) ) ) {
    475                 $blogs[$match[1]]->userblog_id  = $match[1];
    476                 $blogs[$match[1]]->blogname     = $blog->blogname;
    477                 $blogs[$match[1]]->domain       = $blog->domain;
    478                 $blogs[$match[1]]->path         = $blog->path;
    479                 $blogs[$match[1]]->site_id      = $blog->site_id;
    480                 $blogs[$match[1]]->siteurl      = $blog->siteurl;
     479                $blogs[ $blog_id ]->userblog_id = $blog_id;
     480                $blogs[ $blog_id ]->blogname        = $blog->blogname;
     481                $blogs[ $blog_id ]->domain      = $blog->domain;
     482                $blogs[ $blog_id ]->path            = $blog->path;
     483                $blogs[ $blog_id ]->site_id     = $blog->site_id;
     484                $blogs[ $blog_id ]->siteurl     = $blog->siteurl;
    481485            }
    482486        }
Note: See TracChangeset for help on using the changeset viewer.