title: Extending WP_List_Table / handling checkbox options in plugin administration
body: <p>I'm working on a WordPress plugin, and part of that plugin requires extending WP_List_Table and storing any of the items which are checked in that table to an option. I've managed to figure out how to properly setup and display the required table, but how do  I handle storing the checked options?</p>
  
  <p>Here's what I've got so far...</p>
  
  <pre><code>class TDBar_List_Table extends WP_List_Table {
  
      // Reference parent constructor
      function __construct() {
          global $status, $page;
  
          // Set defaults
          parent::__construct( array(
              'singular' =&gt; 'theme',
              'plural' =&gt; 'themes',
              'ajax' =&gt; false
          ));
      }
  
      // Set table classes
      function get_table_classes() {
          return array('widefat', 'wp-list-table', 'themes');
      }
  
      // Setup default column
      function column_default($item, $column_name) {
          switch($column_name) {
              case 'Title':
              case 'URI':
              case'Description':
                  return $item[$column_name];
              default:
                  return print_r($item, true);
          }
      }
  
      // Displaying checkboxes!
      function column_cb($item) {
          return sprintf(
              '&lt;input type="checkbox" name="%1$s" id="%2$s" value="checked" /&gt;',
              //$this-&gt;_args['singular'],
              $item['Stylesheet'] . '_status',
              $item['Stylesheet'] . '_status'
          );
      }
  
      // Display theme title
      function column_title($item) {
          return sprintf(
              '&lt;strong&gt;%1$s&lt;/strong&gt;',
              $item['Title']
          );
      }
  
      // Display theme preview
      function column_preview($item) {
          if (file_exists(get_theme_root() . '/' . $item['Stylesheet'] . '/screenshot.png')) {
              $preview = get_theme_root_uri() . '/' . $item['Stylesheet'] . '/screenshot.png';
          } else {
              $preview = '';
          }
              return sprintf(
                  '&lt;a href="%1$s" class="thickbox" title="%2$s"&gt;&lt;img src="%3$s" style="width: 150px;" /&gt;&lt;/a&gt;',
                  $preview,
                  $item['Title'],
                  $preview
              );
      }
  
      // Display theme description
      function column_description($item) {
          if (isset($item['Version'])) {
              $version = 'Version ' . $item['Version'];
              if (isset($item['Author']) || isset($item['URI']))
                  $version .= '&amp;nbsp;|&amp;nbsp;';
          } else {
              $version = '';
          }
          if (isset($item['Author'])) {
              $author = 'By ' . $item['Author'];
              if (isset($item['URI']))
                  $author .= '&amp;nbsp;|&amp;nbsp;';
          } else {
              $author = '';
          }
          if (isset($item['URI'])) {
              $uri = $item['URI'];
          } else {
              $uri = '';
          }
  
          return sprintf(
              '&lt;div class="theme-description"&gt;&lt;p&gt;%1$s&lt;/p&gt;&lt;/div&gt;&lt;div class="second theme-version-author-uri"&gt;%2$s%3$s%4$s',
              $item['Description'],
              $version,
              $author,
              $uri
          );
      }
  
      // Setup columns
      function get_columns() {
          $columns = array(
              'cb' =&gt; '&lt;input type="checkbox" /&gt;',
              'title' =&gt; 'Theme',
              'preview' =&gt; 'Preview',
              'description' =&gt; 'Description'
          );
          return $columns;
      }
  
      // Make title column sortable
      function get_sortable_columns() {
          $sortable_columns = array(
              'title' =&gt; array('Title', true)
          );
          return $sortable_columns;
      }
  
      // Setup bulk actions
      function get_bulk_actions() {
          $actions = array(
              'update' =&gt; 'Update'
          );
          return $actions;
      }
  
      // Handle bulk actions
      function process_bulk_action() {
          // Define our data source
          if (defined('WP_ALLOW_MULTISITE') &amp;&amp; WP_ALLOW_MULTISITE == true) {
              $themes = get_allowed_themes();
          } else {
              $themes = get_themes();
          }
  
          if ('update' === $this-&gt;current_action()) {
              foreach ($themes as $theme) {
                  if ($theme['Stylesheet'] . '_status' == 'checked') {
                      // Do stuff - here's the problem
                  }
              }
          }
      }
  
      // Handle data preparation
      function prepare_items() {
  
          // How many records per page?
          $per_page = 10;
  
          // Define column headers
          $columns = $this-&gt;get_columns();
          $hidden = array();
          $sortable = $this-&gt;get_sortable_columns();
  
          // Build the array
          $this-&gt;_column_headers = array($columns, $hidden, $sortable);
  
          // Pass off bulk action
          $this-&gt;process_bulk_action();
  
          // Define our data source
          if (defined('WP_ALLOW_MULTISITE') &amp;&amp; WP_ALLOW_MULTISITE == true) {
              $themes = get_allowed_themes();
          } else {
              $themes = get_themes();
          }
  
          // Handle sorting
          function usort_reorder($a,$b) {
              $orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'Title';
              $order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc';
              $result = strcmp($a[$orderby], $b[$orderby]);
              return ($order === 'asc') ? $result : -$result;
          }
          usort($themes, 'usort_reorder');
  
          //MAIN STUFF HERE
          //for ($i = 0; i &lt; count($themes); $i++) {
  
          //}
  
          // Figure out the current page and how many items there are
          $current_page = $this-&gt;get_pagenum();
          $total_items = count($themes);
  
          // Only show the current page
          $themes = array_slice($themes,(($current_page-1)*$per_page),$per_page);
  
          // Display sorted data
          $this-&gt;items = $themes;
  
          // Register pagination options
          $this-&gt;set_pagination_args( array(
              'total_items' =&gt; $total_items,
              'per_page' =&gt; $per_page,
              'total_pages' =&gt; ceil($total_items/$per_page)
          ));
      }
  }
  </code></pre>
  
  <p>Problem is, I can't get it to save properly. I select the rows I want, hit save and it just resets.</p>