[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-admin/ -> user-new.php (source)

   1  <?php
   2  /**
   3   * New User Administration Screen.
   4   *
   5   * @package WordPress
   6   * @subpackage Administration
   7   */
   8  
   9  /** WordPress Administration Bootstrap */
  10  require_once( dirname( __FILE__ ) . '/admin.php' );
  11  
  12  if ( is_multisite() ) {
  13      if ( ! current_user_can( 'create_users' ) && ! current_user_can( 'promote_users' ) ) {
  14          wp_die(
  15              '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
  16              '<p>' . __( 'Sorry, you are not allowed to add users to this network.' ) . '</p>',
  17              403
  18          );
  19      }
  20  } elseif ( ! current_user_can( 'create_users' ) ) {
  21      wp_die(
  22          '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
  23          '<p>' . __( 'Sorry, you are not allowed to create users.' ) . '</p>',
  24          403
  25      );
  26  }
  27  
  28  if ( is_multisite() ) {
  29      add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' );
  30  }
  31  
  32  if ( isset( $_REQUEST['action'] ) && 'adduser' == $_REQUEST['action'] ) {
  33      check_admin_referer( 'add-user', '_wpnonce_add-user' );
  34  
  35      $user_details = null;
  36      $user_email   = wp_unslash( $_REQUEST['email'] );
  37      if ( false !== strpos( $user_email, '@' ) ) {
  38          $user_details = get_user_by( 'email', $user_email );
  39      } else {
  40          if ( current_user_can( 'manage_network_users' ) ) {
  41              $user_details = get_user_by( 'login', $user_email );
  42          } else {
  43              wp_redirect( add_query_arg( array( 'update' => 'enter_email' ), 'user-new.php' ) );
  44              die();
  45          }
  46      }
  47  
  48      if ( ! $user_details ) {
  49          wp_redirect( add_query_arg( array( 'update' => 'does_not_exist' ), 'user-new.php' ) );
  50          die();
  51      }
  52  
  53      if ( ! current_user_can( 'promote_user', $user_details->ID ) ) {
  54          wp_die(
  55              '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
  56              '<p>' . __( 'Sorry, you are not allowed to add users to this network.' ) . '</p>',
  57              403
  58          );
  59      }
  60  
  61      // Adding an existing user to this blog
  62      $new_user_email = $user_details->user_email;
  63      $redirect       = 'user-new.php';
  64      $username       = $user_details->user_login;
  65      $user_id        = $user_details->ID;
  66      if ( $username != null && array_key_exists( $blog_id, get_blogs_of_user( $user_id ) ) ) {
  67          $redirect = add_query_arg( array( 'update' => 'addexisting' ), 'user-new.php' );
  68      } else {
  69          if ( isset( $_POST['noconfirmation'] ) && current_user_can( 'manage_network_users' ) ) {
  70              $result = add_existing_user_to_blog(
  71                  array(
  72                      'user_id' => $user_id,
  73                      'role'    => $_REQUEST['role'],
  74                  )
  75              );
  76  
  77              if ( ! is_wp_error( $result ) ) {
  78                  $redirect = add_query_arg(
  79                      array(
  80                          'update'  => 'addnoconfirmation',
  81                          'user_id' => $user_id,
  82                      ),
  83                      'user-new.php'
  84                  );
  85              } else {
  86                  $redirect = add_query_arg( array( 'update' => 'could_not_add' ), 'user-new.php' );
  87              }
  88          } else {
  89              $newuser_key = wp_generate_password( 20, false );
  90              add_option(
  91                  'new_user_' . $newuser_key,
  92                  array(
  93                      'user_id' => $user_id,
  94                      'email'   => $user_details->user_email,
  95                      'role'    => $_REQUEST['role'],
  96                  )
  97              );
  98  
  99              $roles = get_editable_roles();
 100              $role  = $roles[ $_REQUEST['role'] ];
 101  
 102              /**
 103               * Fires immediately after a user is invited to join a site, but before the notification is sent.
 104               *
 105               * @since 4.4.0
 106               *
 107               * @param int    $user_id     The invited user's ID.
 108               * @param array  $role        Array containing role information for the invited user.
 109               * @param string $newuser_key The key of the invitation.
 110               */
 111              do_action( 'invite_user', $user_id, $role, $newuser_key );
 112  
 113              $switched_locale = switch_to_locale( get_user_locale( $user_details ) );
 114  
 115              /* translators: 1: Site title, 2: Site URL, 3: User role, 4: Activation URL. */
 116              $message = __(
 117                  'Hi,
 118  
 119  You\'ve been invited to join \'%1$s\' at
 120  %2$s with the role of %3$s.
 121  
 122  Please click the following link to confirm the invite:
 123  %4$s'
 124              );
 125  
 126              wp_mail(
 127                  $new_user_email,
 128                  sprintf(
 129                      /* translators: Joining confirmation notification email subject. %s: Site title. */
 130                      __( '[%s] Joining Confirmation' ),
 131                      wp_specialchars_decode( get_option( 'blogname' ) )
 132                  ),
 133                  sprintf(
 134                      $message,
 135                      get_option( 'blogname' ),
 136                      home_url(),
 137                      wp_specialchars_decode( translate_user_role( $role['name'] ) ),
 138                      home_url( "/newbloguser/$newuser_key/" )
 139                  )
 140              );
 141  
 142              if ( $switched_locale ) {
 143                  restore_previous_locale();
 144              }
 145  
 146              $redirect = add_query_arg( array( 'update' => 'add' ), 'user-new.php' );
 147          }
 148      }
 149      wp_redirect( $redirect );
 150      die();
 151  } elseif ( isset( $_REQUEST['action'] ) && 'createuser' == $_REQUEST['action'] ) {
 152      check_admin_referer( 'create-user', '_wpnonce_create-user' );
 153  
 154      if ( ! current_user_can( 'create_users' ) ) {
 155          wp_die(
 156              '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
 157              '<p>' . __( 'Sorry, you are not allowed to create users.' ) . '</p>',
 158              403
 159          );
 160      }
 161  
 162      if ( ! is_multisite() ) {
 163          $user_id = edit_user();
 164  
 165          if ( is_wp_error( $user_id ) ) {
 166              $add_user_errors = $user_id;
 167          } else {
 168              if ( current_user_can( 'list_users' ) ) {
 169                  $redirect = 'users.php?update=add&id=' . $user_id;
 170              } else {
 171                  $redirect = add_query_arg( 'update', 'add', 'user-new.php' );
 172              }
 173              wp_redirect( $redirect );
 174              die();
 175          }
 176      } else {
 177          // Adding a new user to this site
 178          $new_user_email = wp_unslash( $_REQUEST['email'] );
 179          $user_details   = wpmu_validate_user_signup( $_REQUEST['user_login'], $new_user_email );
 180          if ( is_wp_error( $user_details['errors'] ) && $user_details['errors']->has_errors() ) {
 181              $add_user_errors = $user_details['errors'];
 182          } else {
 183              /** This filter is documented in wp-includes/user.php */
 184              $new_user_login = apply_filters( 'pre_user_login', sanitize_user( wp_unslash( $_REQUEST['user_login'] ), true ) );
 185              if ( isset( $_POST['noconfirmation'] ) && current_user_can( 'manage_network_users' ) ) {
 186                  add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email
 187                  add_filter( 'wpmu_welcome_user_notification', '__return_false' ); // Disable welcome email
 188              }
 189              wpmu_signup_user(
 190                  $new_user_login,
 191                  $new_user_email,
 192                  array(
 193                      'add_to_blog' => get_current_blog_id(),
 194                      'new_role'    => $_REQUEST['role'],
 195                  )
 196              );
 197              if ( isset( $_POST['noconfirmation'] ) && current_user_can( 'manage_network_users' ) ) {
 198                  $key      = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $new_user_email ) );
 199                  $new_user = wpmu_activate_signup( $key );
 200                  if ( is_wp_error( $new_user ) ) {
 201                      $redirect = add_query_arg( array( 'update' => 'addnoconfirmation' ), 'user-new.php' );
 202                  } elseif ( ! is_user_member_of_blog( $new_user['user_id'] ) ) {
 203                      $redirect = add_query_arg( array( 'update' => 'created_could_not_add' ), 'user-new.php' );
 204                  } else {
 205                      $redirect = add_query_arg(
 206                          array(
 207                              'update'  => 'addnoconfirmation',
 208                              'user_id' => $new_user['user_id'],
 209                          ),
 210                          'user-new.php'
 211                      );
 212                  }
 213              } else {
 214                  $redirect = add_query_arg( array( 'update' => 'newuserconfirmation' ), 'user-new.php' );
 215              }
 216              wp_redirect( $redirect );
 217              die();
 218          }
 219      }
 220  }
 221  
 222  $title       = __( 'Add New User' );
 223  $parent_file = 'users.php';
 224  
 225  $do_both = false;
 226  if ( is_multisite() && current_user_can( 'promote_users' ) && current_user_can( 'create_users' ) ) {
 227      $do_both = true;
 228  }
 229  
 230  $help = '<p>' . __( 'To add a new user to your site, fill in the form on this screen and click the Add New User button at the bottom.' ) . '</p>';
 231  
 232  if ( is_multisite() ) {
 233      $help .= '<p>' . __( 'Because this is a multisite installation, you may add accounts that already exist on the Network by specifying a username or email, and defining a role. For more options, such as specifying a password, you have to be a Network Administrator and use the hover link under an existing user&#8217;s name to Edit the user profile under Network Admin > All Users.' ) . '</p>' .
 234      '<p>' . __( 'New users will receive an email letting them know they&#8217;ve been added as a user for your site. This email will also contain their password. Check the box if you don&#8217;t want the user to receive a welcome email.' ) . '</p>';
 235  } else {
 236      $help .= '<p>' . __( 'New users are automatically assigned a password, which they can change after logging in. You can view or edit the assigned password by clicking the Show Password button. The username cannot be changed once the user has been added.' ) . '</p>' .
 237  
 238      '<p>' . __( 'By default, new users will receive an email letting them know they&#8217;ve been added as a user for your site. This email will also contain a password reset link. Uncheck the box if you don&#8217;t want to send the new user a welcome email.' ) . '</p>';
 239  }
 240  
 241  $help .= '<p>' . __( 'Remember to click the Add New User button at the bottom of this screen when you are finished.' ) . '</p>';
 242  
 243  get_current_screen()->add_help_tab(
 244      array(
 245          'id'      => 'overview',
 246          'title'   => __( 'Overview' ),
 247          'content' => $help,
 248      )
 249  );
 250  
 251  get_current_screen()->add_help_tab(
 252      array(
 253          'id'      => 'user-roles',
 254          'title'   => __( 'User Roles' ),
 255          'content' => '<p>' . __( 'Here is a basic overview of the different user roles and the permissions associated with each one:' ) . '</p>' .
 256                              '<ul>' .
 257                              '<li>' . __( 'Subscribers can read comments/comment/receive newsletters, etc. but cannot create regular site content.' ) . '</li>' .
 258                              '<li>' . __( 'Contributors can write and manage their posts but not publish posts or upload media files.' ) . '</li>' .
 259                              '<li>' . __( 'Authors can publish and manage their own posts, and are able to upload files.' ) . '</li>' .
 260                              '<li>' . __( 'Editors can publish posts, manage posts as well as manage other people&#8217;s posts, etc.' ) . '</li>' .
 261                              '<li>' . __( 'Administrators have access to all the administration features.' ) . '</li>' .
 262                              '</ul>',
 263      )
 264  );
 265  
 266  get_current_screen()->set_help_sidebar(
 267      '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
 268      '<p>' . __( '<a href="https://wordpress.org/support/article/users-add-new-screen/">Documentation on Adding New Users</a>' ) . '</p>' .
 269      '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
 270  );
 271  
 272  wp_enqueue_script( 'wp-ajax-response' );
 273  wp_enqueue_script( 'user-profile' );
 274  
 275  /**
 276   * Filters whether to enable user auto-complete for non-super admins in Multisite.
 277   *
 278   * @since 3.4.0
 279   *
 280   * @param bool $enable Whether to enable auto-complete for non-super admins. Default false.
 281   */
 282  if ( is_multisite() && current_user_can( 'promote_users' ) && ! wp_is_large_network( 'users' )
 283      && ( current_user_can( 'manage_network_users' ) || apply_filters( 'autocomplete_users_for_site_admins', false ) )
 284  ) {
 285      wp_enqueue_script( 'user-suggest' );
 286  }
 287  
 288  require_once( ABSPATH . 'wp-admin/admin-header.php' );
 289  
 290  if ( isset( $_GET['update'] ) ) {
 291      $messages = array();
 292      if ( is_multisite() ) {
 293          $edit_link = '';
 294          if ( ( isset( $_GET['user_id'] ) ) ) {
 295              $user_id_new = absint( $_GET['user_id'] );
 296              if ( $user_id_new ) {
 297                  $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_id_new ) ) );
 298              }
 299          }
 300  
 301          switch ( $_GET['update'] ) {
 302              case 'newuserconfirmation':
 303                  $messages[] = __( 'Invitation email sent to new user. A confirmation link must be clicked before their account is created.' );
 304                  break;
 305              case 'add':
 306                  $messages[] = __( 'Invitation email sent to user. A confirmation link must be clicked for them to be added to your site.' );
 307                  break;
 308              case 'addnoconfirmation':
 309                  $message = __( 'User has been added to your site.' );
 310  
 311                  if ( $edit_link ) {
 312                      $message .= sprintf( ' <a href="%s">%s</a>', $edit_link, __( 'Edit user' ) );
 313                  }
 314  
 315                  $messages[] = $message;
 316                  break;
 317              case 'addexisting':
 318                  $messages[] = __( 'That user is already a member of this site.' );
 319                  break;
 320              case 'could_not_add':
 321                  $add_user_errors = new WP_Error( 'could_not_add', __( 'That user could not be added to this site.' ) );
 322                  break;
 323              case 'created_could_not_add':
 324                  $add_user_errors = new WP_Error( 'created_could_not_add', __( 'User has been created, but could not be added to this site.' ) );
 325                  break;
 326              case 'does_not_exist':
 327                  $add_user_errors = new WP_Error( 'does_not_exist', __( 'The requested user does not exist.' ) );
 328                  break;
 329              case 'enter_email':
 330                  $add_user_errors = new WP_Error( 'enter_email', __( 'Please enter a valid email address.' ) );
 331                  break;
 332          }
 333      } else {
 334          if ( 'add' == $_GET['update'] ) {
 335              $messages[] = __( 'User added.' );
 336          }
 337      }
 338  }
 339  ?>
 340  <div class="wrap">
 341  <h1 id="add-new-user">
 342  <?php
 343  if ( current_user_can( 'create_users' ) ) {
 344      _e( 'Add New User' );
 345  } elseif ( current_user_can( 'promote_users' ) ) {
 346      _e( 'Add Existing User' );
 347  }
 348  ?>
 349  </h1>
 350  
 351  <?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?>
 352      <div class="error">
 353          <ul>
 354          <?php
 355          foreach ( $errors->get_error_messages() as $err ) {
 356              echo "<li>$err</li>\n";
 357          }
 358          ?>
 359          </ul>
 360      </div>
 361      <?php
 362  endif;
 363  
 364  if ( ! empty( $messages ) ) {
 365      foreach ( $messages as $msg ) {
 366          echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
 367      }
 368  }
 369  ?>
 370  
 371  <?php if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) : ?>
 372      <div class="error">
 373          <?php
 374          foreach ( $add_user_errors->get_error_messages() as $message ) {
 375              echo "<p>$message</p>";
 376          }
 377          ?>
 378      </div>
 379  <?php endif; ?>
 380  <div id="ajax-response"></div>
 381  
 382  <?php
 383  if ( is_multisite() && current_user_can( 'promote_users' ) ) {
 384      if ( $do_both ) {
 385          echo '<h2 id="add-existing-user">' . __( 'Add Existing User' ) . '</h2>';
 386      }
 387      if ( ! current_user_can( 'manage_network_users' ) ) {
 388          echo '<p>' . __( 'Enter the email address of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' ) . '</p>';
 389          $label = __( 'Email' );
 390          $type  = 'email';
 391      } else {
 392          echo '<p>' . __( 'Enter the email address or username of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' ) . '</p>';
 393          $label = __( 'Email or Username' );
 394          $type  = 'text';
 395      }
 396      ?>
 397  <form method="post" name="adduser" id="adduser" class="validate" novalidate="novalidate"
 398      <?php
 399      /**
 400       * Fires inside the adduser form tag.
 401       *
 402       * @since 3.0.0
 403       */
 404      do_action( 'user_new_form_tag' );
 405      ?>
 406  >
 407  <input name="action" type="hidden" value="adduser" />
 408      <?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ); ?>
 409  
 410  <table class="form-table" role="presentation">
 411      <tr class="form-field form-required">
 412          <th scope="row"><label for="adduser-email"><?php echo $label; ?></label></th>
 413          <td><input name="email" type="<?php echo $type; ?>" id="adduser-email" class="wp-suggest-user" value="" /></td>
 414      </tr>
 415      <tr class="form-field">
 416          <th scope="row"><label for="adduser-role"><?php _e( 'Role' ); ?></label></th>
 417          <td><select name="role" id="adduser-role">
 418              <?php wp_dropdown_roles( get_option( 'default_role' ) ); ?>
 419              </select>
 420          </td>
 421      </tr>
 422      <?php if ( current_user_can( 'manage_network_users' ) ) { ?>
 423      <tr>
 424          <th scope="row"><?php _e( 'Skip Confirmation Email' ); ?></th>
 425          <td>
 426              <input type="checkbox" name="noconfirmation" id="adduser-noconfirmation" value="1" />
 427              <label for="adduser-noconfirmation"><?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label>
 428          </td>
 429      </tr>
 430  <?php } ?>
 431  </table>
 432      <?php
 433      /**
 434       * Fires at the end of the new user form.
 435       *
 436       * Passes a contextual string to make both types of new user forms
 437       * uniquely targetable. Contexts are 'add-existing-user' (Multisite),
 438       * and 'add-new-user' (single site and network admin).
 439       *
 440       * @since 3.7.0
 441       *
 442       * @param string $type A contextual string specifying which type of new user form the hook follows.
 443       */
 444      do_action( 'user_new_form', 'add-existing-user' );
 445      ?>
 446      <?php submit_button( __( 'Add Existing User' ), 'primary', 'adduser', true, array( 'id' => 'addusersub' ) ); ?>
 447  </form>
 448      <?php
 449  } // is_multisite()
 450  
 451  if ( current_user_can( 'create_users' ) ) {
 452      if ( $do_both ) {
 453          echo '<h2 id="create-new-user">' . __( 'Add New User' ) . '</h2>';
 454      }
 455      ?>
 456  <p><?php _e( 'Create a brand new user and add them to this site.' ); ?></p>
 457  <form method="post" name="createuser" id="createuser" class="validate" novalidate="novalidate"
 458      <?php
 459      /** This action is documented in wp-admin/user-new.php */
 460      do_action( 'user_new_form_tag' );
 461      ?>
 462  >
 463  <input name="action" type="hidden" value="createuser" />
 464      <?php wp_nonce_field( 'create-user', '_wpnonce_create-user' ); ?>
 465      <?php
 466      // Load up the passed data, else set to a default.
 467      $creating = isset( $_POST['createuser'] );
 468  
 469      $new_user_login             = $creating && isset( $_POST['user_login'] ) ? wp_unslash( $_POST['user_login'] ) : '';
 470      $new_user_firstname         = $creating && isset( $_POST['first_name'] ) ? wp_unslash( $_POST['first_name'] ) : '';
 471      $new_user_lastname          = $creating && isset( $_POST['last_name'] ) ? wp_unslash( $_POST['last_name'] ) : '';
 472      $new_user_email             = $creating && isset( $_POST['email'] ) ? wp_unslash( $_POST['email'] ) : '';
 473      $new_user_uri               = $creating && isset( $_POST['url'] ) ? wp_unslash( $_POST['url'] ) : '';
 474      $new_user_role              = $creating && isset( $_POST['role'] ) ? wp_unslash( $_POST['role'] ) : '';
 475      $new_user_send_notification = $creating && ! isset( $_POST['send_user_notification'] ) ? false : true;
 476      $new_user_ignore_pass       = $creating && isset( $_POST['noconfirmation'] ) ? wp_unslash( $_POST['noconfirmation'] ) : '';
 477  
 478      ?>
 479  <table class="form-table" role="presentation">
 480      <tr class="form-field form-required">
 481          <th scope="row"><label for="user_login"><?php _e( 'Username' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th>
 482          <td><input name="user_login" type="text" id="user_login" value="<?php echo esc_attr( $new_user_login ); ?>" aria-required="true" autocapitalize="none" autocorrect="off" maxlength="60" /></td>
 483      </tr>
 484      <tr class="form-field form-required">
 485          <th scope="row"><label for="email"><?php _e( 'Email' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th>
 486          <td><input name="email" type="email" id="email" value="<?php echo esc_attr( $new_user_email ); ?>" /></td>
 487      </tr>
 488      <?php if ( ! is_multisite() ) { ?>
 489      <tr class="form-field">
 490          <th scope="row"><label for="first_name"><?php _e( 'First Name' ); ?> </label></th>
 491          <td><input name="first_name" type="text" id="first_name" value="<?php echo esc_attr( $new_user_firstname ); ?>" /></td>
 492      </tr>
 493      <tr class="form-field">
 494          <th scope="row"><label for="last_name"><?php _e( 'Last Name' ); ?> </label></th>
 495          <td><input name="last_name" type="text" id="last_name" value="<?php echo esc_attr( $new_user_lastname ); ?>" /></td>
 496      </tr>
 497      <tr class="form-field">
 498          <th scope="row"><label for="url"><?php _e( 'Website' ); ?></label></th>
 499          <td><input name="url" type="url" id="url" class="code" value="<?php echo esc_attr( $new_user_uri ); ?>" /></td>
 500      </tr>
 501      <tr class="form-field form-required user-pass1-wrap">
 502          <th scope="row">
 503              <label for="pass1">
 504                  <?php _e( 'Password' ); ?>
 505                  <span class="description hide-if-js"><?php _e( '(required)' ); ?></span>
 506              </label>
 507          </th>
 508          <td>
 509              <input class="hidden" value=" " /><!-- #24364 workaround -->
 510              <button type="button" class="button wp-generate-pw hide-if-no-js"><?php _e( 'Show password' ); ?></button>
 511              <div class="wp-pwd hide-if-js">
 512                  <?php $initial_password = wp_generate_password( 24 ); ?>
 513                  <span class="password-input-wrapper">
 514                      <input type="password" name="pass1" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" />
 515                  </span>
 516                  <button type="button" class="button wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
 517                      <span class="dashicons dashicons-hidden" aria-hidden="true"></span>
 518                      <span class="text"><?php _e( 'Hide' ); ?></span>
 519                  </button>
 520                  <button type="button" class="button wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Cancel password change' ); ?>">
 521                      <span class="dashicons dashicons-no" aria-hidden="true"></span>
 522                      <span class="text"><?php _e( 'Cancel' ); ?></span>
 523                  </button>
 524                  <div style="display:none" id="pass-strength-result" aria-live="polite"></div>
 525              </div>
 526          </td>
 527      </tr>
 528      <tr class="form-field form-required user-pass2-wrap hide-if-js">
 529          <th scope="row"><label for="pass2"><?php _e( 'Repeat Password' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th>
 530          <td>
 531          <input name="pass2" type="password" id="pass2" autocomplete="off" />
 532          </td>
 533      </tr>
 534      <tr class="pw-weak">
 535          <th><?php _e( 'Confirm Password' ); ?></th>
 536          <td>
 537              <label>
 538                  <input type="checkbox" name="pw_weak" class="pw-checkbox" />
 539                  <?php _e( 'Confirm use of weak password' ); ?>
 540              </label>
 541          </td>
 542      </tr>
 543      <tr>
 544          <th scope="row"><?php _e( 'Send User Notification' ); ?></th>
 545          <td>
 546              <input type="checkbox" name="send_user_notification" id="send_user_notification" value="1" <?php checked( $new_user_send_notification ); ?> />
 547              <label for="send_user_notification"><?php _e( 'Send the new user an email about their account.' ); ?></label>
 548          </td>
 549      </tr>
 550  <?php } // !is_multisite ?>
 551      <tr class="form-field">
 552          <th scope="row"><label for="role"><?php _e( 'Role' ); ?></label></th>
 553          <td><select name="role" id="role">
 554              <?php
 555              if ( ! $new_user_role ) {
 556                  $new_user_role = ! empty( $current_role ) ? $current_role : get_option( 'default_role' );
 557              }
 558              wp_dropdown_roles( $new_user_role );
 559              ?>
 560              </select>
 561          </td>
 562      </tr>
 563      <?php if ( is_multisite() && current_user_can( 'manage_network_users' ) ) { ?>
 564      <tr>
 565          <th scope="row"><?php _e( 'Skip Confirmation Email' ); ?></th>
 566          <td>
 567              <input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" <?php checked( $new_user_ignore_pass ); ?> />
 568              <label for="noconfirmation"><?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label>
 569          </td>
 570      </tr>
 571      <?php } ?>
 572  </table>
 573  
 574      <?php
 575      /** This action is documented in wp-admin/user-new.php */
 576      do_action( 'user_new_form', 'add-new-user' );
 577      ?>
 578  
 579      <?php submit_button( __( 'Add New User' ), 'primary', 'createuser', true, array( 'id' => 'createusersub' ) ); ?>
 580  
 581  </form>
 582  <?php } // current_user_can('create_users') ?>
 583  </div>
 584  <?php
 585  include( ABSPATH . 'wp-admin/admin-footer.php' );


Generated: Wed Dec 11 01:00:03 2019 Cross-referenced by PHPXref 0.7.1