Making WordPress.org


Ignore:
Timestamp:
10/06/2015 03:05:07 PM (9 years ago)
Author:
ocean90
Message:

Rosetta: Allow to make users a Translation Editor even if they aren't a member of the site yet.

If a user isn't a member of the site add them as a subscriber.

Fixes #1237.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/rosetta-roles.php

    r1864 r1942  
    315315
    316316                    if ( ! is_user_member_of_blog( $user_details->ID ) ) {
    317                         wp_redirect( add_query_arg( array( 'error' => 'not-a-member' ), $redirect ) );
    318                         exit;
     317                        $added = add_existing_user_to_blog( array( 'user_id' => $user_details->ID, 'role' => 'subscriber' ) );
     318                        if ( ! $added || is_wp_error( $added ) ) {
     319                            wp_redirect( add_query_arg( array( 'error' => 'not-added-to-site' ), $redirect ) );
     320                            exit;
     321                        }
     322
     323                        // Refresh user data
     324                        $user_details = get_user_by( 'id', $user_details->ID );
    319325                    }
    320326
     
    525531
    526532            'error' => array(
    527                 'no-user-found' => __( 'The user couldn’t be found.', 'rosetta' ),
    528                 'not-a-member'  => __( 'The user is not a member of this site.', 'rosetta' ),
    529                 'user-cannot'   => __( 'The user is not a translation editor.', 'rosetta' ),
    530                 'user-exists'   => __( 'The user is already a translation editor.', 'rosetta' ),
     533                'no-user-found'     => __( 'The user couldn’t be found.', 'rosetta' ),
     534                'not-a-member'      => __( 'The user is not a member of this site.', 'rosetta' ),
     535                'not-added-to-site' => __( 'The user couldn’t be added to this site.', 'rosetta' ),
     536                'user-cannot'       => __( 'The user is not a translation editor.', 'rosetta' ),
     537                'user-exists'       => __( 'The user is already a translation editor.', 'rosetta' ),
    531538            ),
    532539        );
Note: See TracChangeset for help on using the changeset viewer.