Making WordPress.org

Changeset 1942


Ignore:
Timestamp:
10/06/2015 03:05:07 PM (11 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.

Location:
sites/trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles
Files:
2 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                );
  • sites/trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/views/translation-editors.php

    r1419 r1942  
    2323        <?php if ( current_user_can( 'promote_users' ) ) : ?>
    2424                <h3><?php _e( 'Add Translation Editor', 'rosetta' ); ?></h3>
    25                 <p><?php _e( 'Enter the email address or username of an existing user on this site.', 'rosetta' ); ?></p>
     25                <p><?php _e( 'Enter the email address or username of an existing user on wordpress.org.', 'rosetta' ); ?></p>
    2626                <form action="" method="post">
    2727                        <table class="form-table">
Note: See TracChangeset for help on using the changeset viewer.