Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/user-edit.php

    r17381 r15135  
    2525
    2626wp_enqueue_script('user-profile');
     27wp_enqueue_script('password-strength-meter');
    2728
    2829$title = IS_PROFILE_PAGE ? __('Profile') : __('Edit User');
     
    3132else
    3233    $submenu_file = 'profile.php';
    33 
    34 if ( current_user_can('edit_users') && !is_user_admin() )
    35     $parent_file = 'users.php';
    36 else
    37     $parent_file = 'profile.php';
     34$parent_file = 'users.php';
    3835
    3936// contextual help - choose Help on the top right of admin panel to preview this.
     
    8885        wp_update_user( get_object_vars( $user ) );
    8986        delete_option( $current_user->ID . '_new_email' );
    90         wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) );
     87        wp_redirect( add_query_arg( array('updated' => 'true'), admin_url( 'profile.php' ) ) );
    9188        die();
    9289    }
    9390} elseif ( is_multisite() && IS_PROFILE_PAGE && !empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' == $_GET['dismiss'] ) {
    9491    delete_option( $current_user->ID . '_new_email' );
    95     wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) );
     92    wp_redirect( add_query_arg( array('updated' => 'true'), admin_url( 'profile.php' ) ) );
    9693    die();
    9794}
    9895
    9996switch ($action) {
     97case 'switchposts':
     98
     99check_admin_referer();
     100
     101/* TODO: Switch all posts from one user to another user */
     102
     103break;
     104
    100105case 'update':
    101106
     
    124129    if ( $user_id != $current_user->ID ) {
    125130        $cap = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = '{$user_id}' AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'" );
    126         if ( !is_network_admin() && null == $cap && $_POST[ 'role' ] == '' ) {
     131        if ( null == $cap && $_POST[ 'role' ] == '' ) {
    127132            $_POST[ 'role' ] = 'contributor';
    128133            $delete_role = true;
     
    134139        delete_user_meta( $user_id, $blog_prefix . 'capabilities' );
    135140
    136     if ( is_multisite() && is_network_admin() && !IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && !isset($super_admins) && empty( $_POST['super_admin'] ) == is_super_admin( $user_id ) )
     141    if ( is_multisite() && !IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && !isset($super_admins) && empty( $_POST['super_admin'] ) == is_super_admin( $user_id ) )
    137142        empty( $_POST['super_admin'] ) ? revoke_super_admin( $user_id ) : grant_super_admin( $user_id );
    138143}
     
    140145if ( !is_wp_error( $errors ) ) {
    141146    $redirect = (IS_PROFILE_PAGE ? "profile.php?" : "user-edit.php?user_id=$user_id&"). "updated=true";
    142     if ( $wp_http_referer )
    143         $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
     147    $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
    144148    wp_redirect($redirect);
    145149    exit;
     
    152156    wp_die(__('You do not have permission to edit this user.'));
    153157
    154 include (ABSPATH . 'wp-admin/admin-header.php');
     158include ('admin-header.php');
    155159?>
    156160
     
    162166    <p><strong><?php _e('User updated.') ?></strong></p>
    163167    <?php if ( $wp_http_referer && !IS_PROFILE_PAGE ) : ?>
    164     <p><a href="<?php echo esc_url( $wp_http_referer ); ?>"><?php _e('&larr; Back to Authors and Users'); ?></a></p>
     168    <p><a href="users.php"><?php _e('&larr; Back to Authors and Users'); ?></a></p>
    165169    <?php endif; ?>
    166170</div>
     
    174178<h2><?php echo esc_html( $title ); ?></h2>
    175179
    176 <form id="your-profile" action="<?php echo esc_url( self_admin_url( IS_PROFILE_PAGE ? 'profile.php' : 'user-edit.php' ) ); ?>" method="post"<?php do_action('user_edit_form_tag'); ?>>
     180<form id="your-profile" action="<?php echo esc_url( admin_url( IS_PROFILE_PAGE ? 'profile.php' : 'user-edit.php' ) ); ?>" method="post"<?php do_action('user_edit_form_tag'); ?>>
    177181<?php wp_nonce_field('update-user_' . $user_id) ?>
    178182<?php if ( $wp_http_referer ) : ?>
     
    203207<tr>
    204208<th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th>
    205 <td><label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php if ( !empty($profileuser->comment_shortcuts) ) checked('true', $profileuser->comment_shortcuts); ?> /> <?php _e('Enable keyboard shortcuts for comment moderation.'); ?></label> <?php _e('<a href="http://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">More information</a>'); ?></td>
    206 </tr>
    207 <?php endif; ?>
    208 <tr class="show-admin-bar">
    209 <th scope="row"><?php _e('Show Admin Bar')?></th>
    210 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Show Admin Bar') ?></span></legend>
    211 <label for="admin_bar_front">
    212 <input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1" <?php checked( _get_admin_bar_pref( 'front', $profileuser->ID ) ); ?> />
    213 <?php /* translators: Show admin bar when viewing site */ _e( 'when viewing site' ); ?></label><br />
    214 <label for="admin_bar_admin">
    215 <input name="admin_bar_admin" type="checkbox" id="admin_bar_admin" value="1" <?php checked( _get_admin_bar_pref( 'admin', $profileuser->ID ) ); ?> />
    216 <?php /* translators: Show admin bar in dashboard */ _e( 'in dashboard' ); ?></label>
    217 </td>
    218 </tr>
    219 <?php do_action('personal_options', $profileuser); ?>
     209<td><label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php if ( !empty($profileuser->comment_shortcuts) ) checked('true', $profileuser->comment_shortcuts); ?> /> <?php _e('Enable keyboard shortcuts for comment moderation.'); ?></label> <?php _e('<a href="http://codex.wordpress.org/Keyboard_Shortcuts">More information</a>'); ?></td>
     210</tr>
     211<?php
     212endif;
     213do_action('personal_options', $profileuser);
     214?>
    220215</table>
    221216<?php
     
    232227    </tr>
    233228
    234 <?php if ( !IS_PROFILE_PAGE && !is_network_admin() ) : ?>
     229<?php if ( !IS_PROFILE_PAGE ): ?>
    235230<tr><th><label for="role"><?php _e('Role:') ?></label></th>
    236231<td><select name="role" id="role">
     
    251246?>
    252247</select>
    253 <?php endif; //!IS_PROFILE_PAGE
    254 
    255 if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && !isset($super_admins) ) { ?>
    256 <tr><th><label for="role"><?php _e('Super Admin'); ?></label></th>
    257 <td>
    258 <?php if ( $profileuser->user_email != get_site_option( 'admin_email' ) ) : ?>
    259 <p><label><input type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( $profileuser->ID ) ); ?> /> <?php _e( 'Grant this user super admin privileges for the Network.' ); ?></label></p>
    260 <?php else : ?>
    261 <p><?php _e( 'Super admin privileges cannot be removed because this user has the network admin email.' ); ?></p>
    262 <?php endif; ?>
     248<?php if ( is_multisite() && current_user_can( 'manage_network_options' ) && !isset($super_admins) ) { ?>
     249<p><label><input type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( $profileuser->ID ) ); ?> /> <?php _e( 'Grant this user super admin privileges for the Network.'); ?></label></p>
     250<?php } ?>
    263251</td></tr>
    264 <?php } ?>
     252<?php endif; //!IS_PROFILE_PAGE ?>
    265253
    266254<tr>
     
    320308    if ( $new_email && $new_email != $current_user->user_email ) : ?>
    321309    <div class="updated inline">
    322     <p><?php printf( __('There is a pending change of your e-mail to <code>%1$s</code>. <a href="%2$s">Cancel</a>'), $new_email['newemail'], esc_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ) ) ); ?></p>
     310    <p><?php printf( __('There is a pending change of your e-mail to <code>%1$s</code>. <a href="%2$s">Cancel</a>'), $new_email['newemail'], esc_url( admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ) ) ); ?></p>
    323311    </div>
    324312    <?php endif; ?>
     
    332320
    333321<?php
    334     foreach (_wp_get_user_contactmethods( $profileuser ) as $name => $desc) {
     322    foreach (_wp_get_user_contactmethods() as $name => $desc) {
    335323?>
    336324<tr>
     
    348336<tr>
    349337    <th><label for="description"><?php _e('Biographical Info'); ?></label></th>
    350     <td><textarea name="description" id="description" rows="5" cols="30"><?php echo $profileuser->description; // textarea_escaped ?></textarea><br />
     338    <td><textarea name="description" id="description" rows="5" cols="30"><?php echo esc_html($profileuser->description); ?></textarea><br />
    351339    <span class="description"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></span></td>
    352340</tr>
     
    394382<?php } ?>
    395383
    396 <input type="hidden" name="action" value="update" />
    397 <input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr($user_id); ?>" />
    398 
    399 <?php submit_button( IS_PROFILE_PAGE ? __('Update Profile') : __('Update User') ); ?>
    400 
     384<p class="submit">
     385    <input type="hidden" name="action" value="update" />
     386    <input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr($user_id); ?>" />
     387    <input type="submit" class="button-primary" value="<?php IS_PROFILE_PAGE ? esc_attr_e('Update Profile') : esc_attr_e('Update User') ?>" name="submit" />
     388</p>
    401389</form>
    402390</div>
     
    411399</script>
    412400<?php
    413 include( ABSPATH . 'wp-admin/admin-footer.php');
    414 ?>
     401include('./admin-footer.php');
     402?>
Note: See TracChangeset for help on using the changeset viewer.