Make WordPress Core

Ticket #1557: personal-options.diff

File personal-options.diff, 9.7 KB (added by masquerade, 21 years ago)

Patch to consolidate profile.php and options-personal

  • wp-admin/users.php

     
    33require_once( ABSPATH . WPINC . '/registration-functions.php');
    44
    55$title = __('Users');
    6 $parent_file = 'profile.php';
     6$parent_file = 'users.php';
    77       
    88$action = $_REQUEST['action'];
    99
  • wp-admin/options-personal.php

     
    1 <?php
     1<?php 
    22require_once('admin.php');
    33
    4 $title = __('Personal Options');
     4$title = 'Personal Options';
     5
    56$parent_file = 'options-personal.php';
     7include_once('admin-header.php');
     8$profileuser = new WP_User($user_ID);
     9$profiledata = &$profileuser->data;
    610
    7 include('admin-header.php');
     11$bookmarklet_height= 440;
    812?>
    913
    10 <div class="wrap">
    11 <h2><?php _e('Personal Options') ?></h2>
    12 <form id="personal-options" method="post" action="options-personal-update.php">
     14<div class="wrap">
     15<h2><?php _e('Personal Options'); ?></h2>
     16<form name="profile" id="your-profile" action="options-personal-update.php" method="post">
     17<p>
     18<input type="hidden" name="action" value="update" />
     19<input type="hidden" name="checkuser_id" value="<?php echo $user_ID ?>" />
     20</p>
     21
    1322<fieldset>
    14 <p><?php _e('Personal options are just for you, they don&#8217;t affect other users on blog.'); ?><input type="hidden" name="action" value="update" />
    15 <input type="hidden" name="page_options" value="'rich_editing'<?php do_action('personal_option_list'); ?>" /></p>
    16 <table width="100%" cellspacing="2" cellpadding="5" class="editform">
    17 <tr valign="top">
    18 <th width="33%" scope="row"><?php _e('Editing:') ?></th>
    19 <td><label for="rich_editing">
    20 <input name="rich_editing" type="checkbox" id="rich_editing" value="true" <?php checked('true', get_user_option('rich_editing')); ?> />
    21 <?php _e('Use the visual rich editor when writing') ?></label></td>
    22 </tr>
    23 <tr valign="top">
    24 <th scope="row"><?php _e('More:') ?></th>
    25 <td>We should really figure out what else to put here.</td>
    26 </tr>
    27 <?php do_action('personal_options_table'); ?>
    28 </table>
     23<legend><?php _e('Name'); ?></legend>
     24<p><label><?php _e('Username: (no editing)'); ?><br />
     25<input type="text" name="user_login" value="<?php echo $profiledata->user_login; ?>" disabled="disabled" />
     26</label></p>
     27<p><label><?php _e('First name:') ?><br />
     28<input type="text" name="first_name" value="<?php echo $profiledata->first_name ?>" /></label></p>
    2929
    30 </fieldset>
     30<p><label><?php _e('Middle name:') ?><br />
     31<input type="text" name="middle_name" value="<?php echo $profiledata->middle_name ?>" /></label></p>
     32
     33<p><label><?php _e('Last name:') ?><br />
     34<input type="text" name="last_name"  value="<?php echo $profiledata->last_name ?>" /></label></p>
     35
     36<p><label><?php _e('Nickname:') ?><br />
     37<input type="text" name="nickname" value="<?php echo $profiledata->nickname ?>" /></label></p>
     38
     39</p><label><?php _e('Display name publicly as:') ?> <br />
     40<select name="display_name">
     41<option value="<?php echo $profiledata->display_name; ?>"><?php echo $profiledata->display_name; ?></option>
     42<option value="<?php echo $profiledata->nickname ?>"><?php echo $profiledata->nickname ?></option>
     43<option value="<?php echo $profiledata->user_login ?>"><?php echo $profiledata->user_login ?></option>
     44<?php if ( !empty( $profiledata->first_name ) ) : ?>
     45<option value="<?php echo $profiledata->first_name ?>"><?php echo $profiledata->first_name ?></option>
     46<?php endif; ?>
     47<?php if ( !empty( $profiledata->last_name ) ) : ?>
     48<option value="<?php echo $profiledata->last_name ?>"><?php echo $profiledata->last_name ?></option>
     49<?php endif; ?>
     50<?php if ( !empty( $profiledata->first_name ) && !empty( $profiledata->last_name ) ) : ?>
     51<option value="<?php echo $profiledata->first_name." ".$profiledata->last_name ?>"><?php echo $profiledata->first_name." ".$profiledata->last_name ?></option>
     52<option value="<?php echo $profiledata->last_name." ".$profiledata->first_name ?>"><?php echo $profiledata->last_name." ".$profiledata->first_name ?></option>
     53<?php if ( !empty( $profiledata->middle_name ) ) : ?>
     54<option value="<?php echo $n = $profiledata->first_name." ".$profiledata->middle_name." ".$profiledata->last_name ?>"><?php echo $n ?></option>
     55<?php endif; ?>
     56<?php endif; ?>
     57</select></label></p>
     58</fieldset>
     59
     60<fieldset>
     61<legend><?php _e('Contact Info'); ?></legend>
     62
     63<p><label><?php _e('E-mail: (required)') ?><br />
     64<input type="text" name="email" value="<?php echo $profiledata->user_email ?>" /></label></p>
     65
     66<p><label><?php _e('Website:') ?><br />
     67<input type="text" name="url" value="<?php echo $profiledata->user_url ?>" />
     68</label></p>
     69
     70<p><label><?php _e('Flickr Username:') ?><br />
     71<input type="text" name="flickr_username" value="<?php echo $profiledata->flickr_username ?>" />
     72</label></p>
     73
     74<p><label><?php _e('AIM:') ?><br />
     75<input type="text" name="aim" value="<?php echo $profiledata->aim ?>" />
     76</label></p>
     77
     78<p><label><?php _e('Yahoo IM:') ?><br />
     79<input type="text" name="yim" value="<?php echo $profiledata->yim ?>" />
     80</label></p>
     81
     82<p><label><?php _e('Jabber / Google Talk:') ?>
     83<input type="text" name="jabber" value="<?php echo $profiledata->jabber ?>" /></label>
     84</p>
     85</fieldset>
     86<br clear="all" />
     87<fieldset>
     88<legend><?php _e('About yourself'); ?></legend>
     89<p class="desc"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></p>
     90<p><textarea name="description" rows="5" cols="30"><?php echo $profiledata->description ?></textarea></p>
     91</fieldset>
     92
     93<?php
     94$show_password_fields = apply_filters('show_password_fields', true);
     95if ( $show_password_fields ) :
     96?>
     97<fieldset>
     98<legend><?php _e('Update Your Password'); ?></legend>
     99<p class="desc"><?php _e('If you would like to change your password type a new one twice below. Otherwise leave this blank.'); ?></p>
     100<p><label><?php _e('New Password:'); ?><br />
     101<input type="password" name="pass1" size="16" value="" />
     102</label></p>
     103<p><label><?php _e('Type it one more time:'); ?><br />
     104<input type="password" name="pass2" size="16" value="" />
     105</label></p>
     106</fieldset>
     107<?php endif; ?>
     108
     109<?php do_action('show_user_profile'); ?>
     110
     111<br clear="all" />
     112<fieldset>
     113<legend><?php _e('Preferences'); ?></legend>
     114<p class="desc"><?php _e('These options will only effect you, not everybody on your blog.'); ?></p>
     115<p><label>
     116<?php _e('Use the visual rich editor when wriitng: ') ?>
     117<input name="rich_editing" type="checkbox" id="rich_editing" style="width: .75em;" value="true" <?php checked('true', get_user_option('rich_editing')); ?> />
     118</p></label>
     119</fieldset>
     120<br clear="all" />
     121        <table width="99%"  border="0" cellspacing="2" cellpadding="3" class="editform">
     122    <?php
     123    if(count($profileuser->caps) > count($profileuser->roles)):
     124    ?>
     125    <tr>
     126      <th scope="row"><?php _e('Additional Capabilities:') ?></th>
     127      <td><?php
     128                        $output = '';
     129                        foreach($profileuser->caps as $cap => $value) {
     130                                if(!$wp_roles->is_role($cap)) {
     131                                        if($output != '') $output .= ', ';
     132                                        $output .= $value ? $cap : "Denied: {$cap}";
     133                                }
     134                        }
     135                        echo $output;
     136                        ?></td>
     137    </tr>
     138    <?php
     139    endif;
     140    ?>
     141  </table>
    31142<p class="submit">
    32 <input type="submit" name="Submit" value="<?php _e('Update Personal Options') ?> &raquo;" />
     143<input type="submit" value="<?php _e('Update Profile &raquo;') ?>" name="submit" />
    33144</p>
    34 </form>
    35 </div>
    36 <?php include('admin-footer.php'); ?>
    37  No newline at end of file
     145</form>
     146
     147</div>
     148
     149<?php include('admin-footer.php'); ?>
  • wp-admin/menu.php

     
    1111$menu[25] = array(__('Presentation'), 'switch_themes', 'themes.php');
    1212$menu[30] = array(__('Plugins'), 'activate_plugins', 'plugins.php');
    1313if ( current_user_can('edit_users') )
    14         $menu[35] = array(__('Users'), 'read', 'profile.php');
    15 else
    16         $menu[35] = array(__('Profile'), 'read', 'profile.php');
     14        $menu[35] = array(__('Users'), 'read', 'users.php');
    1715$menu[40] = array(__('Options'), 'read', 'options-personal.php');
    1816$menu[45] = array(__('Import'), 'import', 'import.php');
    1917
     
    3634$submenu['link-manager.php'][15] = array(__('Link Categories'), 'manage_links', 'link-categories.php');
    3735$submenu['link-manager.php'][20] = array(__('Import Links'), 'manage_links', 'link-import.php');
    3836
    39 $submenu['profile.php'][5] = array(__('Your Profile'), 'read', 'profile.php');
    40 $submenu['profile.php'][10] = array(__('Authors &amp; Users'), 'edit_users', 'users.php');
     37$submenu['profile.php'][5] = array(__('Authors &amp; Users'), 'edit_users', 'users.php');
    4138
    4239$submenu['options-personal.php'][5] = array(__('Personal'), 'read', 'options-personal.php');
    4340$submenu['options-personal.php'][10] = array(__('General'), 'manage_options', 'options-general.php');
  • wp-admin/options-personal-update.php

     
    55check_admin_referer();
    66
    77if ( isset( $_POST['action'] ) ) {
     8        //Update User Info
     9        $errors = edit_user($user_ID);
     10
     11        if (count($errors) != 0) {
     12                foreach ($errors as $id => $error) {
     13                        echo $error . '<br/>';
     14                }
     15                exit;
     16        }
     17
     18        //Update the personal options
    819        if ( !isset( $_POST['rich_editing'] ) )
    920                $_POST['rich_editing'] = 'false';
     21
    1022        update_user_option( $current_user->id, 'rich_editing', $wpdb->escape($_POST['rich_editing']), true );
    1123        do_action('personal_options_update');
    1224
     
    1527        wp_redirect($goback);
    1628}
    1729
    18 ?>
    19  No newline at end of file
     30?>