Changeset 6697
- Timestamp:
- 01/31/2008 09:44:17 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/profile.php
r6429 r6697 1 1 <?php 2 require_once('admin.php'); 3 4 function profile_js ( ) { 2 $is_profile_page = true; 3 require_once('user-edit.php'); 5 4 ?> 6 <script type="text/javascript">7 function check_pass_strength ( ) {8 9 var pass = jQuery('#pass1').val();10 var user = jQuery('#user_login').val();11 12 // get the result as an object, i'm tired of typing it13 var res = jQuery('#pass-strength-result');14 15 var strength = passwordStrength(pass, user);16 17 jQuery(res).removeClass('short bad good strong');18 19 if ( strength == 'Bad' ) {20 jQuery(res).addClass('bad');21 jQuery(res).html( pwsL10n.bad );22 }23 else if ( strength == 'Good' ) {24 jQuery(res).addClass('good');25 jQuery(res).html( pwsL10n.good );26 }27 else if ( strength == 'Strong' ) {28 jQuery(res).addClass('strong');29 jQuery(res).html( pwsL10n.strong );30 }31 else {32 // this catches 'Too short' and the off chance anything else comes along33 jQuery(res).addClass('short');34 jQuery(res).html( pwsL10n.short );35 }36 37 }38 39 jQuery(document).ready( function() { jQuery('#pass1').keyup( check_pass_strength ) } );40 </script>41 <?php42 }43 44 add_action('admin_head', 'profile_js');45 46 wp_enqueue_script('jquery');47 wp_enqueue_script('password-strength-meter');48 49 $title = __('Profile');50 51 if ( current_user_can('edit_users') )52 $parent_file = 'users.php';53 else54 $parent_file = 'profile.php';55 include_once('admin-header.php');56 $profileuser = get_user_to_edit($user_ID);57 58 $bookmarklet_height= 440;59 ?>60 61 <?php if ( isset($_GET['updated']) ) { ?>62 <div id="message" class="updated fade">63 <p><strong><?php _e('Profile updated.') ?></strong></p>64 </div>65 <?php } ?>66 67 <div class="wrap">68 <h2><?php _e('Your Profile and Personal Options'); ?></h2>69 <form name="profile" id="your-profile" action="profile-update.php" method="post">70 <?php wp_nonce_field('update-profile_' . $user_ID) ?>71 <p>72 <input type="hidden" name="from" value="profile" />73 <input type="hidden" name="checkuser_id" value="<?php echo $user_ID ?>" />74 </p>75 76 <h3><?php _e('Personal Options'); ?></h3>77 78 <?php if ( rich_edit_exists() ) : // don't bother showing the option if the editor has been removed ?>79 <p><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="true" <?php checked('true', get_user_option('rich_editing')); ?> />80 <?php _e('Use the visual editor when writing') ?></label></p>81 <?php endif; ?>82 83 <?php do_action('profile_personal_options'); ?>84 85 <p class="submit"><input type="submit" value="<?php _e('Update Profile »') ?>" name="submit" /></p>86 87 <fieldset id="information">88 <legend><?php _e('Name'); ?></legend>89 <p><label><?php _e('Username: (no editing)'); ?><br />90 <input type="text" name="user_login" id="user_login" value="<?php echo $profileuser->user_login; ?>" disabled="disabled" />91 </label></p>92 93 <p><label><?php _e('First name:') ?><br />94 <input type="text" name="first_name" id="first_name" value="<?php echo $profileuser->first_name ?>" /></label></p>95 96 <p><label><?php _e('Last name:') ?><br />97 <input type="text" name="last_name" id="last_name" value="<?php echo $profileuser->last_name ?>" /></label></p>98 99 <p><label><?php _e('Nickname:') ?><br />100 <input type="text" name="nickname" id="nickname" value="<?php echo $profileuser->nickname ?>" /></label></p>101 102 <p><label><?php _e('Display name publicly as:') ?> <br />103 <select name="display_name" id="display_name">104 <option value="<?php echo $profileuser->display_name; ?>"><?php echo $profileuser->display_name; ?></option>105 <option value="<?php echo $profileuser->nickname ?>"><?php echo $profileuser->nickname ?></option>106 <option value="<?php echo $profileuser->user_login ?>"><?php echo $profileuser->user_login ?></option>107 <?php if ( !empty( $profileuser->first_name ) ) : ?>108 <option value="<?php echo $profileuser->first_name ?>"><?php echo $profileuser->first_name ?></option>109 <?php endif; ?>110 <?php if ( !empty( $profileuser->last_name ) ) : ?>111 <option value="<?php echo $profileuser->last_name ?>"><?php echo $profileuser->last_name ?></option>112 <?php endif; ?>113 <?php if ( !empty( $profileuser->first_name ) && !empty( $profileuser->last_name ) ) : ?>114 <option value="<?php echo $profileuser->first_name." ".$profileuser->last_name ?>"><?php echo $profileuser->first_name." ".$profileuser->last_name ?></option>115 <option value="<?php echo $profileuser->last_name." ".$profileuser->first_name ?>"><?php echo $profileuser->last_name." ".$profileuser->first_name ?></option>116 <?php endif; ?>117 </select></label></p>118 </fieldset>119 120 <fieldset id="contact-info">121 <legend><?php _e('Contact Info'); ?></legend>122 123 <p><label><?php _e('E-mail: (required)') ?><br />124 <input type="text" name="email" id="email" value="<?php echo $profileuser->user_email ?>" /></label></p>125 126 <p><label><?php _e('Website:') ?><br />127 <input type="text" name="url" id="url" value="<?php echo $profileuser->user_url ?>" />128 </label></p>129 130 <p><label><?php _e('AIM:') ?><br />131 <input type="text" name="aim" id="aim" value="<?php echo $profileuser->aim ?>" />132 </label></p>133 134 <p><label><?php _e('Yahoo IM:') ?><br />135 <input type="text" name="yim" id="yim" value="<?php echo $profileuser->yim ?>" />136 </label></p>137 138 <p><label><?php _e('Jabber / Google Talk:') ?><br />139 <input type="text" name="jabber" id="jabber" value="<?php echo $profileuser->jabber ?>" /></label>140 </p>141 </fieldset>142 <br clear="all" />143 <fieldset id="about-yourself">144 <legend><?php _e('About Yourself'); ?></legend>145 <p class="desc"><?php _e('Share a little biographical information. '); ?></p>146 <p><textarea name="description" id="description" rows="5" cols="30"><?php echo $profileuser->description ?></textarea></p>147 </fieldset>148 149 <?php150 $show_password_fields = apply_filters('show_password_fields', true);151 if ( $show_password_fields ) :152 ?>153 <fieldset id="update-password">154 <legend><?php _e('Update Your Password'); ?></legend>155 <p class="desc"><?php _e('If you would like to change your password type a new one twice below. Otherwise leave this blank.'); ?></p>156 <p><label><?php _e('New Password:'); ?><br />157 <input type="password" name="pass1" id="pass1" size="16" value="" />158 </label></p>159 <p><label><?php _e('Type it one more time:'); ?><br />160 <input type="password" name="pass2" id="pass2" size="16" value="" />161 </label></p>162 <p><strong><?php _e('Password Strength:'); ?></strong></p>163 <div id="pass-strength-result"><?php _e('Too short'); ?></div>164 <p><?php _e('Hint: Use upper and lower case characters, numbers and symbols like !"?$%^&( in your password.'); ?></p>165 </fieldset>166 <?php endif; ?>167 168 <?php do_action('show_user_profile'); ?>169 170 <br clear="all" />171 172 <table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform">173 <?php174 if(count($profileuser->caps) > count($profileuser->roles)):175 ?>176 <tr>177 <th scope="row"><?php _e('Additional Capabilities:') ?></th>178 <td><?php179 $output = '';180 foreach($profileuser->caps as $cap => $value) {181 if(!$wp_roles->is_role($cap)) {182 if($output != '') $output .= ', ';183 $output .= $value ? $cap : "Denied: {$cap}";184 }185 }186 echo $output;187 ?></td>188 </tr>189 <?php190 endif;191 ?>192 </table>193 <p class="submit"><input type="submit" value="<?php _e('Update Profile »') ?>" name="submit" /></p>194 </form>195 196 </div>197 198 <?php include('admin-footer.php'); ?> -
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> -
trunk/wp-includes/capabilities.php
r6364 r6697 291 291 break; 292 292 case 'edit_user': 293 $caps[] = 'edit_users'; 293 if ( !isset($args[0]) || $user_id != $args[0] ) { 294 $caps[] = 'edit_users'; 295 } 294 296 break; 295 297 case 'delete_post':
Note: See TracChangeset
for help on using the changeset viewer.