WordPress.org

Make WordPress Core

Changeset 16179


Ignore:
Timestamp:
11/04/2010 09:31:58 AM (8 years ago)
Author:
westi
Message:

Don't mangle the primary_blog option when trying to fix it. Don't set people to be a subscriber on a blog they already have a role for. See #15316

File:
1 edited

Legend:

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

    r16178 r16179  
    8080    $primary_blog = get_user_meta( $user_id, 'primary_blog', true );
    8181    $first_blog = current($blogs);
    82     if ( $primary_blog ) {
     82    if ( false !== $primary_blog ) {
    8383        if ( ! isset( $blogs[ $primary_blog ] ) ) {
    84             add_user_to_blog( $first_blog->blog_id, $user_id, 'subscriber' );
    85             update_user_meta( $user_id, 'primary_blog', $first_blog->blog_id );
     84            update_user_meta( $user_id, 'primary_blog', $first_blog->userblog_id );
    8685            $primary = $first_blog;
    8786        } else {
     
    8988        }
    9089    } else {
    91         add_user_to_blog( $first_blog->blog_id, $user_id, 'subscriber' );
    92         update_user_meta( $user_id, 'primary_blog', $first_blog->blog_id );
     90        //TODO Review this call to add_user_to_blog too - to get here the user must have a role on this blog?
     91        add_user_to_blog( $first_blog->userblog_id, $user_id, 'subscriber' );
     92        update_user_meta( $user_id, 'primary_blog', $first_blog->userblog_id );
    9393        $primary = $first_blog;
    9494    }
Note: See TracChangeset for help on using the changeset viewer.