WordPress.org

Making WordPress.org

Changeset 4081


Ignore:
Timestamp:
09/16/2016 07:17:46 PM (4 years ago)
Author:
ocean90
Message:

Rosetta: Don't use get_site_by_path() for fetching the team site.

get_site_by_path() returns the main site if the team site doesn't exist yet because it also searches sites with path = '/'.

See #1983.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/rosetta/inc/site/class-locale-main.php

    r4080 r4081  
    4545    public function register_events() {
    4646        if ( is_admin() ) {
    47             $user_sync = new User\Sync();
    48             $user_sync->set_destination_site( get_site_by_path( get_site()->domain, Locale_Team::$path ) );
    49             $user_sync->set_roles_to_sync( [ 'editor' ] );
    50             $user_sync->setup();
     47            // Get the team site.
     48            $result = get_sites( [
     49                'domain' => get_site()->domain,
     50                'path'   => Locale_Team::$path,
     51                'number' => 1,
     52            ] );
     53            $team_site = array_shift( $result );
     54
     55            if ( $team_site ) {
     56                $user_sync = new User\Sync();
     57                $user_sync->set_destination_site( $team_site );
     58                $user_sync->set_roles_to_sync( [ 'editor' ] );
     59                $user_sync->setup();
     60            }
    5161        }
    5262
Note: See TracChangeset for help on using the changeset viewer.