Viewing 2 reply threads
  • Author
    Posts
    • #1635
      luminaire801
      Member

      Hi guys, i’m trying to create a dashboard Menu Item for users with Subscriber user role. So far, I’ve created the menu using the piklist_admin_pages filter by following the Settings Pages guide. I wanted to have a list-table on that page so I copied the code from field-list-table.php. However the list-table’s css/html seems to be malformed. Am I missing something?

      This is the code I used for the Menu Item

      //This adds a new Item Menu for the Customer-Portal
      add_filter('piklist_admin_pages', 'customer_portal_func');
        function customer_portal_func($pages)
        {
           $pages[] = array(
            'page_title' => __('Customer Portal')
            ,'menu_title' => __('Customer Portal', 'piklist')
            ,'capability' => 'subscriber'
            ,'menu_slug' => 'customer_portal'
            ,'setting' => 'customer_portal'
            ,'menu_icon' => plugins_url('piklist/parts/img/piklist-icon.png')
            ,'page_icon' => plugins_url('piklist/parts/img/piklist-page-icon-32.png')
          );
       
          return $pages;
        }

      This is the code I used for the Settings Page output

      
      <?php
      /*
      Title:
      Setting: customer_portal
      Order: 20
      */
      
      global $wpdb;
      
        $data = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE post_type = %s AND post_status = %s", 'post', 'publish'));
        
        foreach ($data as &$row)
        {
          $user_data = get_userdata($row->post_author);
          $row->post_author = $user_data->user_login;
        }
        
        piklist('list_table', array(
          'name' => 'Object Example'
          ,'data' => $data
          ,'per_page' => 10
          ,'key' => 'ID'
          ,'column' => 'post_title'
          ,'columns' => array(
            'post_title' => 'Post title'
            ,'post_date' => 'Date'
            ,'post_author' => 'Author'
            ,'comment_count' => 'Comments'
          )
        ));
      
    • #1700
      tripflex
      Member

      It looks right but i can’t find a single thing documentation wise regarding list table besides that example file.

      A little help anyone?

    • #1704
      Steve
      Keymaster

      List Table is not fully flushed out yet. We’ve included it in demos so you can play with it. Once it’s completed, documentation will go up.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.