/CT

Custom Tables - WordPress development toolkit to easily create custom database tables with admin CRUD actions

Primary LanguagePHP

About Custom Tables

Custom Tables (CT) is a WordPress developers toolkit to handle custom database table workflow similar to WordPress CPT.

Check example.php file included on this project to see a few examples to get it working.

CT has been developed as internal library for GamiPress plugin in order to bring to GamiPress's logs and user earnings tables the same features as WordPress post types (admin UI, cached query, rest API endpoints, etc).

Important: CT public API is in development phase, this means current version is unstable and much of the current features will change. To use this library on live project be sure you know you are doing!

Contributions are really appreciated! Looking for help to standarize functions and hooks as well as for documentation.

Features (work in progress)

Custom table registration:

  • Custom table registration (like registering a WordPress post type)
  • Automatic table creation if not exists
  • Easy field definition
  • Schema parser
  • Automatic schema updater (yay!)
  • Database parameters (collate, engine, etc)
  • Ability to show or hide from admin UI (disable UI for a desired table)
  • Custom Capabilities (with support for administrators)
  • Meta data functionality
  • Query class to handled cached queries (like WP_Query but for custom tables)
  • Rest API support (custom table and meta data)

List view (with features similar to WP tables):

  • Pagination
  • Search
  • Sortable Columns
  • Bulk actions
  • User screen settings
  • List view views
  • Trash functionality?
  • Revisions functionality?
  • Delete Permanently action

Edit View (similar to WP edit screen):

  • Meta boxes
  • Screen options
  • Show hide Meta boxes
  • Allow user to toggle view columns
  • Allow define edit view columns (to force to 1 column)
  • Delete Permanently action

Other features

Plugins

  • Ajax List Table: Utility to render a Custom Tables (CT) List Table with ajax searching and pagination.
  • Rest API Docs: Rest API docs generator for Custom Tables (CT).

Changelog

1.0.7

  • Bug Fixes
  • Fixed PHP notices caused by add_submenu_page() function when passing null as first parameter.

1.0.6

Improvements

  • Added more nonce checks to prevent CSRF attacks.

1.0.5

Improvements

  • Added more nonce checks to prevent CSRF attacks.

1.0.4

Improvements

  • Reduced the number of "Show tables" queries.

1.0.3

Improvements

  • Added support for CMB2 fields data removal if field has "multiple" set to "true".

1.0.2

Bug Fixes

  • Make use of the min() function when defining length of the table keys (thanks to @mholubowski).

1.0.1

Improvements

  • Prevent to add index length for DATETIME fields (thanks to @mholubowski, fixes #9).
  • Quote all fields and indexes during database creation.

1.0.0 Initial release.