]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/users.php
WordPress 4.2.2-scripts
[autoinstalls/wordpress.git] / wp-admin / users.php
index 1f4fc5e7e907c9b7ba9b72be3cd0650a8cb7f8c4..27e264ca5992533ac80cbffaa60435f91794591a 100644 (file)
 require_once( dirname( __FILE__ ) . '/admin.php' );
 
 if ( ! current_user_can( 'list_users' ) )
-       wp_die( __( 'Cheatin’ uh?' ) );
+       wp_die( __( 'Cheatin’ uh?' ), 403 );
 
 $wp_list_table = _get_list_table('WP_Users_List_Table');
 $pagenum = $wp_list_table->get_pagenum();
 $title = __('Users');
 $parent_file = 'users.php';
 
-add_screen_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) );
+add_screen_option( 'per_page' );
 
 // contextual help - choose Help on the top right of admin panel to preview this.
 get_current_screen()->add_help_tab( array(
@@ -43,9 +43,9 @@ $help = '<p>' . __('Hovering over a row in the users list will display action li
        '<li>' . __('Edit takes you to the editable profile screen for that user. You can also reach that screen by clicking on the username.') . '</li>';
 
 if ( is_multisite() )
-       $help .= '<li>' . __( 'Remove allows you to remove a user from your site. It does not delete their posts. You can also remove multiple users at once by using Bulk Actions.' ) . '</li>';
+       $help .= '<li>' . __( 'Remove allows you to remove a user from your site. It does not delete their content. You can also remove multiple users at once by using Bulk Actions.' ) . '</li>';
 else
-       $help .= '<li>' . __( 'Delete brings you to the Delete Users screen for confirmation, where you can permanently remove a user from your site and delete their posts. You can also delete multiple users at once by using Bulk Actions.' ) . '</li>';
+       $help .= '<li>' . __( 'Delete brings you to the Delete Users screen for confirmation, where you can permanently remove a user from your site and delete their content. You can also delete multiple users at once by using Bulk Actions.' ) . '</li>';
 
 $help .= '</ul>';
 
@@ -58,9 +58,9 @@ unset( $help );
 
 get_current_screen()->set_help_sidebar(
     '<p><strong>' . __('For more information:') . '</strong></p>' .
-    '<p>' . __('<a href="http://codex.wordpress.org/Users_Screen" target="_blank">Documentation on Managing Users</a>') . '</p>' .
-    '<p>' . __('<a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Descriptions of Roles and Capabilities</a>') . '</p>' .
-    '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+    '<p>' . __('<a href="https://codex.wordpress.org/Users_Screen" target="_blank">Documentation on Managing Users</a>') . '</p>' .
+    '<p>' . __('<a href="https://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Descriptions of Roles and Capabilities</a>') . '</p>' .
+    '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
 );
 
 if ( empty($_REQUEST) ) {
@@ -128,7 +128,7 @@ case 'promote':
 
                // If the user doesn't already belong to the blog, bail.
                if ( is_multisite() && !is_user_member_of_blog( $id ) )
-                       wp_die(__('Cheatin&#8217; uh?'));
+                       wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
 
                $user = get_userdata( $id );
                $user->set_role($_REQUEST['new_role']);
@@ -137,8 +137,6 @@ case 'promote':
        wp_redirect(add_query_arg('update', $update, $redirect));
        exit();
 
-break;
-
 case 'dodelete':
        if ( is_multisite() )
                wp_die( __('User deletion is not allowed from this screen.') );
@@ -188,8 +186,6 @@ case 'dodelete':
        wp_redirect($redirect);
        exit();
 
-break;
-
 case 'delete':
        if ( is_multisite() )
                wp_die( __('User deletion is not allowed from this screen.') );
@@ -213,19 +209,24 @@ case 'delete':
 
        include( ABSPATH . 'wp-admin/admin-header.php' );
 ?>
-<form action="" method="post" name="updateusers" id="updateusers">
+<form method="post" name="updateusers" id="updateusers">
 <?php wp_nonce_field('delete-users') ?>
 <?php echo $referer; ?>
 
 <div class="wrap">
-<?php screen_icon(); ?>
 <h2><?php _e('Delete Users'); ?></h2>
 <?php if ( isset( $_REQUEST['error'] ) ) : ?>
-<div class="error">
-       <p><strong><?php _e( 'ERROR:' ); ?></strong> <?php _e( 'Please select an option.' ); ?></p>
-</div>
+       <div class="error">
+               <p><strong><?php _e( 'ERROR:' ); ?></strong> <?php _e( 'Please select an option.' ); ?></p>
+       </div>
+<?php endif; ?>
+
+<?php if ( 1 == count( $userids ) ) : ?>
+       <p><?php _e( 'You have specified this user for deletion:' ); ?></p>
+<?php else : ?>
+       <p><?php _e( 'You have specified these users for deletion:' ); ?></p>
 <?php endif; ?>
-<p><?php echo _n( 'You have specified this user for deletion:', 'You have specified these users for deletion:', count( $userids ) ); ?></p>
+
 <ul>
 <?php
        $go_delete = 0;
@@ -241,14 +242,28 @@ case 'delete':
        ?>
        </ul>
 <?php if ( $go_delete ) : ?>
-       <fieldset><p><legend><?php echo _n( 'What should be done with posts owned by this user?', 'What should be done with posts owned by these users?', $go_delete ); ?></legend></p>
+       <?php if ( 1 == $go_delete ) : ?>
+               <fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); ?></legend></p>
+       <?php else : ?>
+               <fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' ); ?></legend></p>
+       <?php endif; ?>
        <ul style="list-style:none;">
                <li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" />
-               <?php _e('Delete all posts.'); ?></label></li>
+               <?php _e('Delete all content.'); ?></label></li>
                <li><input type="radio" id="delete_option1" name="delete_option" value="reassign" />
-               <?php echo '<label for="delete_option1">' . __( 'Attribute all posts to:' ) . '</label> ';
+               <?php echo '<label for="delete_option1">' . __( 'Attribute all content to:' ) . '</label> ';
                wp_dropdown_users( array( 'name' => 'reassign_user', 'exclude' => array_diff( $userids, array($current_user->ID) ) ) ); ?></li>
        </ul></fieldset>
+       <?php
+       /**
+        * Fires at the end of the delete users form prior to the confirm button.
+        *
+        * @since 4.0.0
+        *
+        * @param WP_User $current_user WP_User object for the user being deleted.
+        */
+       do_action( 'delete_user_form', $current_user );
+       ?>
        <input type="hidden" name="action" value="dodelete" />
        <?php submit_button( __('Confirm Deletion'), 'secondary' ); ?>
 <?php else : ?>
@@ -294,8 +309,6 @@ case 'doremove':
        wp_redirect($redirect);
        exit;
 
-break;
-
 case 'remove':
 
        check_admin_referer('bulk-users');
@@ -318,12 +331,11 @@ case 'remove':
 
        include( ABSPATH . 'wp-admin/admin-header.php' );
 ?>
-<form action="" method="post" name="updateusers" id="updateusers">
+<form method="post" name="updateusers" id="updateusers">
 <?php wp_nonce_field('remove-users') ?>
 <?php echo $referer; ?>
 
 <div class="wrap">
-<?php screen_icon(); ?>
 <h2><?php _e('Remove Users from Site'); ?></h2>
 <p><?php _e('You have specified these users for removal:'); ?></p>
 <ul>
@@ -342,6 +354,7 @@ case 'remove':
                }
        }
        ?>
+</ul>
 <?php if ( $go_remove ) : ?>
                <input type="hidden" name="action" value="doremove" />
                <?php submit_button( __('Confirm Removal'), 'secondary' ); ?>
@@ -376,34 +389,39 @@ default:
                case 'del':
                case 'del_many':
                        $delete_count = isset($_GET['delete_count']) ? (int) $_GET['delete_count'] : 0;
-                       $messages[] = '<div id="message" class="updated"><p>' . sprintf( _n( 'User deleted.', '%s users deleted.', $delete_count ), number_format_i18n( $delete_count ) ) . '</p></div>';
+                       if ( 1 == $delete_count ) {
+                               $message = __( 'User deleted.' );
+                       } else {
+                               $message = _n( '%s user deleted.', '%s users deleted.', $delete_count );
+                       }
+                       $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $delete_count ) ) . '</p></div>';
                        break;
                case 'add':
                        if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) {
-                               $messages[] = '<div id="message" class="updated"><p>' . sprintf( __( 'New user created. <a href="%s">Edit user</a>' ),
+                               $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( __( 'New user created. <a href="%s">Edit user</a>' ),
                                        esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
                                                self_admin_url( 'user-edit.php?user_id=' . $user_id ) ) ) ) . '</p></div>';
                        } else {
-                               $messages[] = '<div id="message" class="updated"><p>' . __( 'New user created.' ) . '</p></div>';
+                               $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'New user created.' ) . '</p></div>';
                        }
                        break;
                case 'promote':
-                       $messages[] = '<div id="message" class="updated"><p>' . __('Changed roles.') . '</p></div>';
+                       $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Changed roles.') . '</p></div>';
                        break;
                case 'err_admin_role':
-                       $messages[] = '<div id="message" class="error"><p>' . __('The current user&#8217;s role must have user editing capabilities.') . '</p></div>';
-                       $messages[] = '<div id="message" class="updated"><p>' . __('Other user roles have been changed.') . '</p></div>';
+                       $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('The current user&#8217;s role must have user editing capabilities.') . '</p></div>';
+                       $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other user roles have been changed.') . '</p></div>';
                        break;
                case 'err_admin_del':
-                       $messages[] = '<div id="message" class="error"><p>' . __('You can&#8217;t delete the current user.') . '</p></div>';
-                       $messages[] = '<div id="message" class="updated"><p>' . __('Other users have been deleted.') . '</p></div>';
+                       $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('You can&#8217;t delete the current user.') . '</p></div>';
+                       $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other users have been deleted.') . '</p></div>';
                        break;
                case 'remove':
-                       $messages[] = '<div id="message" class="updated fade"><p>' . __('User removed from this site.') . '</p></div>';
+                       $messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('User removed from this site.') . '</p></div>';
                        break;
                case 'err_admin_remove':
-                       $messages[] = '<div id="message" class="error"><p>' . __("You can't remove the current user.") . '</p></div>';
-                       $messages[] = '<div id="message" class="updated fade"><p>' . __('Other users have been removed.') . '</p></div>';
+                       $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __("You can't remove the current user.") . '</p></div>';
+                       $messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('Other users have been removed.') . '</p></div>';
                        break;
                }
        endif; ?>
@@ -425,7 +443,6 @@ if ( ! empty($messages) ) {
 } ?>
 
 <div class="wrap">
-<?php screen_icon(); ?>
 <h2>
 <?php
 echo esc_html( $title );
@@ -441,7 +458,7 @@ if ( $usersearch )
 
 <?php $wp_list_table->views(); ?>
 
-<form action="" method="get">
+<form method="get">
 
 <?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?>