Ticket #20221: user-new.diff

File user-new.diff, 3.1 KB (added by williamsba1, 15 months ago)
  • user-new.php

     
    4242        if ( false !== strpos($_REQUEST[ 'email' ], '@') ) { 
    4343                $user_details = get_user_by('email', $_REQUEST[ 'email' ]); 
    4444        } else { 
    45                 if ( is_super_admin() ) { 
     45                if ( current_user_can( 'manage_options' ) ) { 
    4646                        $user_details = get_user_by('login', $_REQUEST[ 'email' ]); 
    4747                } else { 
    4848                        wp_redirect( add_query_arg( array('update' => 'enter_email'), 'user-new.php' ) ); 
     
    6666        if ( ( $username != null && !is_super_admin( $user_id ) ) && ( array_key_exists($blog_id, get_blogs_of_user($user_id)) ) ) { 
    6767                $redirect = add_query_arg( array('update' => 'addexisting'), 'user-new.php' ); 
    6868        } else { 
    69                 if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { 
     69                if ( isset( $_POST[ 'noconfirmation' ] ) && current_user_can( 'manage_options' ) ) { 
    7070                        add_existing_user_to_blog( array( 'user_id' => $user_id, 'role' => $_REQUEST[ 'role' ] ) ); 
    7171                        $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' ); 
    7272                } else { 
     
    115115                        $add_user_errors = $user_details[ 'errors' ]; 
    116116                } else { 
    117117                        $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true)); 
    118                         if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { 
     118                        if ( isset( $_POST[ 'noconfirmation' ] ) && current_user_can( 'manage_options' ) ) { 
    119119                                add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email 
    120120                        } 
    121121                        wpmu_signup_user( $new_user_login, $_REQUEST[ 'email' ], array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST[ 'role' ] ) ); 
    122                         if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { 
     122                        if ( isset( $_POST[ 'noconfirmation' ] ) && current_user_can( 'manage_options' ) ) { 
    123123                                $key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $_REQUEST[ 'email' ] ) ); 
    124124                                wpmu_activate_signup( $key ); 
    125125                                $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' ); 
     
    281281                        </select> 
    282282                </td> 
    283283        </tr> 
    284 <?php if ( is_super_admin() ) { ?> 
     284<?php if ( current_user_can( 'manage_options' ) ) { ?> 
    285285        <tr> 
    286286                <th scope="row"><label for="adduser-noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th> 
    287287                <td><label for="adduser-noconfirmation"><input type="checkbox" name="noconfirmation" id="adduser-noconfirmation" value="1" /> <?php _e( 'Add the user without sending them a confirmation email.' ); ?></label></td> 
     
    365365                        </select> 
    366366                </td> 
    367367        </tr> 
    368         <?php if ( is_multisite() && is_super_admin() ) { ?> 
     368        <?php if ( is_multisite() && current_user_can( 'manage_options' ) ) { ?> 
    369369        <tr> 
    370370                <th scope="row"><label for="noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th> 
    371371                <td><label for="noconfirmation"><input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" <?php checked( $new_user_ignore_pass ); ?> /> <?php _e( 'Add the user without sending them a confirmation email.' ); ?></label></td>