Make WordPress Core

Changeset 3061


Ignore:
Timestamp:
11/13/2005 04:40:18 AM (19 years ago)
Author:
matt
Message:

Update all to eol-style: native, also fixes #1645

Location:
trunk/wp-admin
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-db.php

    • Property svn:eol-style set to native
  • trunk/wp-admin/edit-form-ajax-cat.php

    • Property svn:eol-style set to native
  • trunk/wp-admin/edit-link-form.php

    • Property svn:eol-style set to native
  • trunk/wp-admin/execute-pings.php

    • Property svn:eol-style set to native
  • trunk/wp-admin/import.php

    • Property svn:eol-style set to native
  • trunk/wp-admin/inline-uploading.php

    • Property svn:eol-style set to native
  • trunk/wp-admin/list-manipulation.js

    • Property svn:eol-style set to native
  • trunk/wp-admin/list-manipulation.php

    • Property svn:eol-style set to native
  • trunk/wp-admin/users.php

    r2872 r3061  
    77   
    88$action = $_REQUEST['action'];
     9$update = '';
    910
    1011switch ($action) {
     
    2021        die(__('You can’t edit users.'));
    2122
    22     $userids = $_POST['users'];
    23     foreach($userids as $id) {
    24         $user = new WP_User($id);
    25         $user->set_role($_POST['new_role']);
    26     }
     23    $userids = $_POST['users'];
     24    $update = 'promote';
     25    foreach($userids as $id) {
     26        // The new role of the current user must also have edit_users caps
     27        if($id == $current_user->id && !$wp_roles->role_objects[$_POST['new_role']]->has_cap('edit_users')) {
     28            $update = 'err_admin_role';
     29            continue;
     30        }
     31
     32        $user = new WP_User($id);
     33        $user->set_role($_POST['new_role']);
     34    }
    2735       
    28     header('Location: users.php?update=promote');
     36    header('Location: users.php?update=' . $update);
    2937
    3038break;
     
    3442    check_admin_referer();
    3543
    36     if (empty($_POST['users'])) {
     44    if ( empty($_POST['users']) ) {
    3745        header('Location: users.php');
    3846    }
     
    4351    $userids = $_POST['users'];
    4452   
    45     foreach($userids as $id) {
    46         switch($_POST['delete_option']) {
     53    $update = 'del';
     54    foreach ($userids as $id) {
     55        if($id == $current_user->id) {
     56            $update = 'err_admin_del';
     57            continue;
     58        }
     59        switch($_POST['delete_option']) {
    4760        case 'delete':
    4861            wp_delete_user($id);
     
    5467    }
    5568
    56     header('Location: users.php?update=del');
     69    header('Location: users.php?update=' . $update);
    5770
    5871break;
     
    7588<form action="" method="post" name="updateusers" id="updateusers">
    7689<div class="wrap">
    77     <h2><?php _e('Delete Users'); ?></h2>
    78     <p><?php _e('You have specified these users for deletion:'); ?></p>
    79     <ul>
    80     <?php
    81     foreach($userids as $id) {
    82         $user = new WP_User($id);
    83         echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />";
    84         echo "{$id}: {$user->data->user_login}</li>\n";
    85     }
    86     $all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users ORDER BY user_login");
    87     $user_dropdown = '<select name="reassign_user">';
    88     foreach($all_logins as $login) {
    89         if(!in_array($login->ID, $userids)) {
    90             $user_dropdown .= "<option value=\"{$login->ID}\">{$login->user_login}</option>";
    91         }
    92     }
    93     $user_dropdown .= '</select>';
    94     ?>
    95     </ul>
    96     <p><?php _e('What should be done with posts and links owned by this user?'); ?></p>
     90<h2><?php _e('Delete Users'); ?></h2>
     91<p><?php _e('You have specified these users for deletion:'); ?></p>
     92<ul>
     93<?php
     94    $go_delete = false;
     95    foreach ($userids as $id) {
     96        $user = new WP_User($id);
     97        if ($id == $current_user->id) {
     98            echo "<li>" . sprintf('ID #%1s: %2s <strong>The current user will not be deleted.</strong>', $id, $user->data->user_login) . "</li>\n";
     99        } else {
     100            echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf('ID #%1s: %2s', $id, $user->data->user_login) . "</li>\n";
     101            $go_delete = true;
     102        }
     103    }
     104    $all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users ORDER BY user_login");
     105    $user_dropdown = '<select name="reassign_user">';
     106    foreach ($all_logins as $login) {
     107        if ( $login->ID == $current_user->id || !in_array($login->ID, $userids) ) {
     108            $user_dropdown .= "<option value=\"{$login->ID}\">{$login->user_login}</option>";
     109        }
     110    }
     111    $user_dropdown .= '</select>';
     112    ?>
     113    </ul>
     114<?php if($go_delete) : ?>
     115    <p><?php _e('What should be done with posts and links owned by this user?'); ?></p>
    97116    <ul style="list-style:none;">
    98117        <li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" checked="checked" />
     
    103122    <input type="hidden" name="action" value="dodelete" />
    104123    <p class="submit"><input type="submit" name="submit" value="<?php _e('Confirm Deletion'); ?>" /></p>
     124<?php else : ?>
     125    <p><?php _e('There are no valid users selected for deletion.'); ?></p>
     126<?php endif; ?>
    105127</div>
    106128</form>
     
    150172        ?>
    151173            <div id="message" class="updated fade"><p><?php _e('Changed roles.'); ?></p></div>
     174        <?php
     175            break;
     176        case 'err_admin_role':
     177        ?>
     178            <div id="message" class="error"><p><?php _e("The current user's role must have user editing capabilities."); ?></p></div>
     179            <div id="message" class="updated fade"><p><?php _e('Other user roles have been changed.'); ?></p></div>
     180        <?php
     181            break;
     182        case 'err_admin_del':
     183        ?>
     184            <div id="message" class="error"><p><?php _e("You can't delete the current user."); ?></p></div>
     185            <div id="message" class="updated fade"><p><?php _e('Other users have been deleted.'); ?></p></div>
    152186        <?php
    153187            break;
Note: See TracChangeset for help on using the changeset viewer.