Changeset 6697 for trunk/wp-admin/user-edit.php
- Timestamp:
- 01/31/2008 09:44:17 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/user-edit.php
r6652 r6697 1 1 <?php 2 3 $is_profile_page = isset($is_profile_page) && $is_profile_page? true : false; 4 2 5 require_once('admin.php'); 3 6 4 $title = __('Edit User'); 5 if ( current_user_can('edit_users') ) 7 function profile_js ( ) { 8 ?> 9 <script type="text/javascript"> 10 function check_pass_strength ( ) { 11 12 var pass = jQuery('#pass1').val(); 13 var user = jQuery('#user_login').val(); 14 15 // get the result as an object, i'm tired of typing it 16 var res = jQuery('#pass-strength-result'); 17 18 var strength = passwordStrength(pass, user); 19 20 jQuery(res).removeClass('short bad good strong'); 21 22 if ( strength == 'Bad' ) { 23 jQuery(res).addClass('bad'); 24 jQuery(res).html( pwsL10n.bad ); 25 } 26 else if ( strength == 'Good' ) { 27 jQuery(res).addClass('good'); 28 jQuery(res).html( pwsL10n.good ); 29 } 30 else if ( strength == 'Strong' ) { 31 jQuery(res).addClass('strong'); 32 jQuery(res).html( pwsL10n.strong ); 33 } 34 else { 35 // this catches 'Too short' and the off chance anything else comes along 36 jQuery(res).addClass('short'); 37 jQuery(res).html( pwsL10n.short ); 38 } 39 40 } 41 42 jQuery(document).ready( function() { jQuery('#pass1').keyup( check_pass_strength ) } ); 43 </script> 44 <?php 45 } 46 47 if ( $is_profile_page ) { 48 add_action('admin_head', 'profile_js'); 49 wp_enqueue_script('jquery'); 50 wp_enqueue_script('password-strength-meter'); 51 } 52 53 $title = $is_profile_page? __('Profile') : __('Edit User'); 54 if ( current_user_can('edit_users') && !$is_profile_page ) 6 55 $parent_file = 'users.php'; 7 56 else … … 16 65 17 66 if ( !$user_id ) 18 wp_die(__('Invalid user ID.')); 67 if ( $is_profile_page ) { 68 $current_user = wp_get_current_user(); 69 $user_id = $current_user->ID; 70 } else { 71 wp_die(__('Invalid user ID.')); 72 } 19 73 20 74 switch ($action) { … … 34 88 wp_die(__('You do not have permission to edit this user.')); 35 89 90 if ( $is_profile_page ) { 91 do_action('personal_options_update'); 92 } 93 36 94 $errors = edit_user($user_id); 37 95 38 96 if( !is_wp_error( $errors ) ) { 39 $redirect = "user-edit.php?user_id=$user_id&updated=true";97 $redirect = ($is_profile_page? "profile.php?" : "user-edit.php?user_id=$user_id&"). "updated=true"; 40 98 $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect); 41 99 wp_redirect($redirect); … … 55 113 <div id="message" class="updated fade"> 56 114 <p><strong><?php _e('User updated.') ?></strong></p> 57 <?php if ( $wp_http_referer ) : ?>115 <?php if ( $wp_http_referer && !$is_profile_page ) : ?> 58 116 <p><a href="users.php"><?php _e('« Back to Authors and Users'); ?></a></p> 59 117 <?php endif; ?> … … 72 130 73 131 <div class="wrap"> 74 <h2><?php _e('Edit User'); ?></h2>75 76 <form name="profile" id="your-profile" action=" user-edit.php" method="post">132 <h2><?php $is_profile_page? _e('Your Profile and Personal Options') : _e('Edit User'); ?></h2> 133 134 <form name="profile" id="your-profile" action="" method="post"> 77 135 <?php wp_nonce_field('update-user_' . $user_id) ?> 78 136 <?php if ( $wp_http_referer ) : ?> … … 84 142 </p> 85 143 144 <h3><?php _e('Personal Options'); ?></h3> 145 146 <?php if ( rich_edit_exists() ) : // don't bother showing the option if the editor has been removed ?> 86 147 <p><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="true" <?php checked('true', $profileuser->rich_editing); ?> /> <?php _e('Use the visual editor when writing'); ?></label></p> 87 88 <p class="submit"><input type="submit" value="<?php _e('Update User »'); ?>" name="submit" /></p> 148 <?php endif; ?> 149 150 <?php 151 if ( $is_profile_page ) { 152 do_action('profile_personal_options'); 153 } 154 ?> 155 156 <p class="submit"><input type="submit" value="<?php $is_profile_page? _e('Update Profile »') : _e('Update User »'); ?>" name="submit" /></p> 89 157 90 158 <fieldset> 91 159 <legend><?php _e('Name'); ?></legend> 92 160 <p><label><?php _e('Username: (no editing)'); ?><br /> 93 <input type="text" name="user_login" value="<?php echo $profileuser->user_login; ?>" disabled="disabled" /> 94 </label></p> 95 161 <input type="text" name="user_login" id="user_login" value="<?php echo $profileuser->user_login; ?>" disabled="disabled" /> 162 </label></p> 163 164 <?php if ( !$is_profile_page ): ?> 96 165 <p><label><?php _e('Role:') ?><br /> 97 166 <?php … … 115 184 echo $role_list . '</select>'; 116 185 ?></label></p> 186 <?php endif; ?> 117 187 118 188 <p><label><?php _e('First name:') ?><br /> … … 169 239 <br clear="all" /> 170 240 <fieldset> 171 <legend><?php _e('About the user'); ?></legend>241 <legend><?php $is_profile_page? _e('About Yourself') : _e('About the user'); ?></legend> 172 242 <p class="desc"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></p> 173 243 <p><textarea name="description" rows="5" cols="30"><?php echo $profileuser->description ?></textarea></p> … … 179 249 ?> 180 250 <fieldset> 181 <legend><?php _e("Update User's Password"); ?></legend>182 <p class="desc"><?php _e("If you would like to change the user'spassword type a new one twice below. Otherwise leave this blank."); ?></p>251 <legend><?php $is_profile_page? _e('Update Your Password') : _e("Update User's Password"); ?></legend> 252 <p class="desc"><?php _e("If you would like to change the password type a new one twice below. Otherwise leave this blank."); ?></p> 183 253 <p><label><?php _e('New Password:'); ?><br /> 184 <input type="password" name="pass1" size="16" value="" />254 <input type="password" name="pass1" id="pass1" size="16" value="" /> 185 255 </label></p> 186 256 <p><label><?php _e('Type it one more time:'); ?><br /> 187 <input type="password" name="pass2" size="16" value="" /> 188 </label></p> 257 <input type="password" name="pass2" id="pass2" size="16" value="" /> 258 </label></p> 259 <?php if ( $is_profile_page ): ?> 260 <p><strong><?php _e('Password Strength:'); ?></strong></p> 261 <div id="pass-strength-result"><?php _e('Too short'); ?></div> 262 <p><?php _e('Hint: Use upper and lower case characters, numbers and symbols like !"?$%^&( in your password.'); ?></p> 263 <?php endif; ?> 189 264 </fieldset> 190 265 <?php endif; ?> 191 266 192 <?php do_action('edit_user_profile'); ?> 267 <?php 268 if ( $is_profile_page ) { 269 do_action('show_user_profile'); 270 } else { 271 do_action('edit_user_profile'); 272 } 273 ?> 193 274 194 275 <br clear="all" /> … … 217 298 <input type="hidden" name="action" value="update" /> 218 299 <input type="hidden" name="user_id" id="user_id" value="<?php echo $user_id; ?>" /> 219 <input type="submit" value="<?php _e('Update User »') ?>" name="submit" />300 <input type="submit" value="<?php $is_profile_page? _e('Update Profile »') : _e('Update User »') ?>" name="submit" /> 220 301 </p> 221 302 </form>
Note: See TracChangeset
for help on using the changeset viewer.