Making WordPress.org

Changeset 4082


Ignore:
Timestamp:
09/16/2016 07:23:11 PM (10 years ago)
Author:
ocean90
Message:

Rosetta: Add locale managers as editors to the team site.

See #1983.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/rosetta/inc
Files:
2 edited

Legend:

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

    r4081 r4082  
    5656                                $user_sync = new User\Sync();
    5757                                $user_sync->set_destination_site( $team_site );
    58                                 $user_sync->set_roles_to_sync( [ 'editor' ] );
     58                                $user_sync->set_roles_to_sync( [
     59                                        'editor' => 'editor',
     60                                        Role\Locale_Manager::get_name() => 'editor',
     61                                ] );
    5962                                $user_sync->setup();
    6063                        }
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/rosetta/inc/user/class-sync.php

    r4030 r4082  
    4848         * Sets the array of roles to sync.
    4949         *
    50          * @param array $roles_to_sync An array of roles to sync.
     50         * @param array $roles_to_sync An array of roles to sync. The key of an item
     51         *                             is the source role, the value the destination role.
    5152         */
    5253        public function set_roles_to_sync( array $roles_to_sync ) {
     
    7980                remove_action( 'set_user_role',    [ $this, 'add_user_to_site' ], 10 );
    8081
    81                 if ( ! in_array( $role, $this->roles_to_sync, true ) ) {
     82                if ( ! in_array( $role, array_keys( $this->roles_to_sync ), true ) ) {
    8283                        return;
    8384                }
     
    8788                }
    8889
    89                 add_user_to_blog( $this->destination_site->id, $user_id, $role );
     90                add_user_to_blog( $this->destination_site->id, $user_id, $this->roles_to_sync[ $role ] );
    9091        }
    9192}
Note: See TracChangeset for help on using the changeset viewer.