Make WordPress Core

Ticket #26564: 26564.diff

File 26564.diff, 3.8 KB (added by leewillis77, 11 years ago)
  • wp-admin/includes/class-wp-users-list-table.php

     
    99 */
    1010class WP_Users_List_Table extends WP_List_Table {
    1111
     12        /**
     13         * The site ID that this table is being generated for.
     14         *
     15         * @since 3.1.0
     16         * @var   int $site_id The site ID.
     17         */
    1218        var $site_id;
     19
     20        /**
     21         * True if the table is being generated for the multisite site users page.
     22         *
     23         * @since 3.1.0
     24         * @var   bool $is_site_users
     25         */
    1326        var $is_site_users;
    1427
     28        /**
     29         * Constructor
     30         *
     31         * @since 3.1.0
     32         * @see   WP_List_Table::__construct()
     33         */
    1534        function __construct( $args = array() ) {
    1635                parent::__construct( array(
    1736                        'singular' => 'user',
     
    2544                        $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
    2645        }
    2746
     47        /**
     48         * @since 3.1.0
     49         * @see   WP_List_Table::__construct()
     50         */
    2851        function ajax_user_can() {
    2952                if ( $this->is_site_users )
    3053                        return current_user_can( 'manage_sites' );
     
    3255                        return current_user_can( 'list_users' );
    3356        }
    3457
     58        /**
     59         * @since 3.1.0
     60         * @see   WP_List_Table::prepare_items()
     61         */
    3562        function prepare_items() {
    3663                global $role, $usersearch;
    3764
     
    75102                ) );
    76103        }
    77104
     105        /**
     106         * @since 3.1.0
     107         * @see   WP_List_Table::no_items()
     108         */
    78109        function no_items() {
    79110                _e( 'No matching users were found.' );
    80111        }
    81112
     113        /**
     114         * Returns an associative array listing all the views that can be used with this table.
     115         *
     116         * Provides a list of roles, andd user count for that role for easy filter of the user table.
     117         *
     118         * @since  3.1.0
     119         * @see    WP_List_Table::get_views()
     120         * @return array An array of HTML links, one for each view.
     121         */
    82122        function get_views() {
    83123                global $wp_roles, $role;
    84124
     
    119159                return $role_links;
    120160        }
    121161
     162        /**
     163         * @since  3.1.0
     164         * @see    WP_List_Table::get_bulk_actions()
     165         */
    122166        function get_bulk_actions() {
    123167                $actions = array();
    124168
     
    133177                return $actions;
    134178        }
    135179
     180        /**
     181         * Output the controls to allow user roles to be changed in bulk.
     182         *
     183         * @since 3.1.0
     184         * @see   WP_List_Table::extra_tablenav()
     185         * @param string $which Whether this is being invoked above ("top") or below the table ("bottom").
     186         */
    136187        function extra_tablenav( $which ) {
    137188                if ( 'top' != $which )
    138189                        return;
     
    152203                echo '</div>';
    153204        }
    154205
     206        /**
     207         * Capture the bulk action required, and return it.
     208         *
     209         * Overriden from the base class implementation to capture the role change drop-down.
     210         *
     211         * @since  3.1.0
     212         * @see    WP_List_Table::current_action()
     213         * @return string The bulk action required.
     214         */
    155215        function current_action() {
    156216                if ( isset($_REQUEST['changeit']) && !empty($_REQUEST['new_role']) )
    157217                        return 'promote';
     
    159219                return parent::current_action();
    160220        }
    161221
     222        /**
     223         *  @since  3.1.0
     224         *  @see    WP_List_Table::get_columns()
     225         *  @return array Array in which the key is the ID of the column, and the value is the description.
     226         */
    162227        function get_columns() {
    163228                $c = array(
    164229                        'cb'       => '<input type="checkbox" />',
     
    175240                return $c;
    176241        }
    177242
     243        /**
     244         * @since 3.1.0
     245         * @see   WP_List_Table::get_sortable_columns()
     246         */
    178247        function get_sortable_columns() {
    179248                $c = array(
    180249                        'username' => 'login',
     
    188257                return $c;
    189258        }
    190259
     260        /**
     261         * @since 3.1.0
     262         * @see   WP_List_Table::display_rows()
     263         */
    191264        function display_rows() {
    192265                // Query the post counts for this page
    193266                if ( ! $this->is_site_users )
     
    216289        /**
    217290         * Generate HTML for a single row on the users.php admin panel.
    218291         *
    219          * @since 2.1.0
     292         * @since 3.1.0
    220293         *
    221294         * @param object $user_object
    222295         * @param string $style Optional. Attributes added to the TR element. Must be sanitized.