-
+ CC6C5CAEF32096D22F7344D3542CDCFBEDDBEFFE5C09FFDE7B7111572983A275E24A42361D15BA7C9C7B67FA23FB868D1B64FD4628C276E7410336DFF3A61E93mp-wp/wp-admin/user-new.php(0 . 0)(1 . 143)
59412 <?php
59413 /**
59414 * New User Administration Panel.
59415 *
59416 * @package WordPress
59417 * @subpackage Administration
59418 */
59419
59420 /** WordPress Administration Bootstrap */
59421 require_once('admin.php');
59422
59423 if ( !current_user_can('create_users') )
59424 wp_die(__('Cheatin’ uh?'));
59425
59426 /** WordPress Registration API */
59427 require_once( ABSPATH . WPINC . '/registration.php');
59428
59429 if ( isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action'] ) {
59430 check_admin_referer('add-user');
59431
59432 if ( ! current_user_can('create_users') )
59433 wp_die(__('You can’t create users.'));
59434
59435 $user_id = add_user();
59436
59437 if ( is_wp_error( $user_id ) ) {
59438 $add_user_errors = $user_id;
59439 } else {
59440 $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true));
59441 $redirect = 'users.php?usersearch='. urlencode($new_user_login) . '&update=add';
59442 wp_redirect( $redirect . '#user-' . $user_id );
59443 die();
59444 }
59445 }
59446
59447 $title = __('Add New User');
59448 $parent_file = 'users.php';
59449
59450 wp_enqueue_script('admin-users');
59451
59452 require_once ('admin-header.php');
59453
59454 ?>
59455 <div class="wrap">
59456 <?php screen_icon(); ?>
59457 <h2 id="add-new-user"><?php _e('Add New User') ?></h2>
59458
59459 <?php if ( isset($errors) && is_wp_error( $errors ) ) : ?>
59460 <div class="error">
59461 <ul>
59462 <?php
59463 foreach ( $errors->get_error_messages() as $err )
59464 echo "<li>$err</li>\n";
59465 ?>
59466 </ul>
59467 </div>
59468 <?php endif;
59469
59470 if ( ! empty($messages) ) {
59471 foreach ( $messages as $msg )
59472 echo $msg;
59473 } ?>
59474
59475 <?php if ( isset($add_user_errors) && is_wp_error( $add_user_errors ) ) : ?>
59476 <div class="error">
59477 <?php
59478 foreach ( $add_user_errors->get_error_messages() as $message )
59479 echo "<p>$message</p>";
59480 ?>
59481 </div>
59482 <?php endif; ?>
59483 <div id="ajax-response"></div>
59484
59485 <?php
59486 if ( get_option('users_can_register') )
59487 echo '<p>' . sprintf(__('Users can <a href="%1$s">register themselves</a> or you can manually create users here.'), site_url('wp-register.php')) . '</p>';
59488 else
59489 echo '<p>' . sprintf(__('Users cannot currently <a href="%1$s">register themselves</a>, but you can manually create users here.'), admin_url('options-general.php#users_can_register')) . '</p>';
59490 ?>
59491 <form action="#add-new-user" method="post" name="adduser" id="adduser" class="add:users: validate">
59492 <?php wp_nonce_field('add-user') ?>
59493 <?php
59494 //Load up the passed data, else set to a default.
59495 foreach ( array('user_login' => 'login', 'first_name' => 'firstname', 'last_name' => 'lastname',
59496 'email' => 'email', 'url' => 'uri', 'role' => 'role') as $post_field => $var ) {
59497 $var = "new_user_$var";
59498 if ( ! isset($$var) )
59499 $$var = isset($_POST[$post_field]) ? stripslashes($_POST[$post_field]) : '';
59500 }
59501 ?>
59502 <table class="form-table">
59503 <tr class="form-field form-required">
59504 <th scope="row"><label for="user_login"><?php _e('Username (required)') ?></label><input name="action" type="hidden" id="action" value="adduser" /></th>
59505 <td ><input name="user_login" type="text" id="user_login" value="<?php echo $new_user_login; ?>" aria-required="true" /></td>
59506 </tr>
59507 <tr class="form-field">
59508 <th scope="row"><label for="first_name"><?php _e('First Name') ?> </label></th>
59509 <td><input name="first_name" type="text" id="first_name" value="<?php echo $new_user_firstname; ?>" /></td>
59510 </tr>
59511 <tr class="form-field">
59512 <th scope="row"><label for="last_name"><?php _e('Last Name') ?> </label></th>
59513 <td><input name="last_name" type="text" id="last_name" value="<?php echo $new_user_lastname; ?>" /></td>
59514 </tr>
59515 <tr class="form-field form-required">
59516 <th scope="row"><label for="email"><?php _e('E-mail (required)') ?></label></th>
59517 <td><input name="email" type="text" id="email" value="<?php echo $new_user_email; ?>" /></td>
59518 </tr>
59519 <tr class="form-field">
59520 <th scope="row"><label for="url"><?php _e('Website') ?></label></th>
59521 <td><input name="url" type="text" id="url" value="<?php echo $new_user_uri; ?>" /></td>
59522 </tr>
59523
59524 <?php if ( apply_filters('show_password_fields', true) ) : ?>
59525 <tr class="form-field form-required">
59526 <th scope="row"><label for="pass1"><?php _e('Password (twice)') ?> </label></th>
59527 <td><input name="pass1" type="password" id="pass1" autocomplete="off" />
59528 <br />
59529 <input name="pass2" type="password" id="pass2" autocomplete="off"/></td>
59530 </tr>
59531 <?php endif; ?>
59532
59533 <tr class="form-field">
59534 <th scope="row"><label for="role"><?php _e('Role'); ?></label></th>
59535 <td><select name="role" id="role">
59536 <?php
59537 if ( !$new_user_role )
59538 $new_user_role = !empty($current_role) ? $current_role : get_option('default_role');
59539 wp_dropdown_roles($new_user_role);
59540 ?>
59541 </select>
59542 </td>
59543 </tr>
59544 </table>
59545 <p class="submit">
59546 <input name="adduser" type="submit" id="addusersub" class="button-primary" value="<?php _e('Add User') ?>" />
59547 </p>
59548 </form>
59549
59550 </div>
59551
59552 <?php
59553 include('admin-footer.php');
59554 ?>