Index

  1. Home
  2. Docs
  3. Index
  4. Shortcodes
  5. Shortcode wpdadiehard

Shortcode wpdadiehard

Use shortcode wpdadiehard to add data administration for a specific table or Data Projects page to a web page.

Shortcode wpdadiehard must be enabled:
Settings > WP Data Access > Plugin > Shortcode [ wpdadiehard ]

Data Projects shortcodes

Shortcode wpdadiehard can be used to add a Data Projects page to a web page. Supported shortcode parameters:

  • project_id (Data Projects -> Project ID)
  • page_id (Data Projects -> Page ID)
  • filter_field_name (field name(s) to be filtered)
  • filter_field_value (field value(s) to filter, performs a LIKE and therefor allows wildcards)

Copy/paste shortcode from a Data Project

There’s no need to type in the shortcode. The shortcode can be copied from Data Projects to your clipboard and pasted into your page or post.

  • Start Data Projects
  • Edit your project
  • Click on link Shortcode(s)
  • Copy shortcode to clipboard
  • Edit your page or post
  • Paste shortcode into your page or post

Example

[wpdadiehard project_id="7" page_id="11"]

> Click here for a live example

User defined shortcodes

Shortcode wpdadiehard can also be used without Data Projects. This alternative does not support all the features available with Data Projects and is maintained for backward compatibility. Do not use this shortcode type if you are starting a new project. New features will not be added to this shortcode implementation. Supported shortcode parameters:

  • schema_name (use this to access tables located outside the WordPress database, default = “”)
  • table_name (name of the table on which you want to perform data administration tasks)
  • title (title for list table, not shown on data entry form)
  • subtitle (title for list table, not shown on data entry form)
  • show_view_link (“true” or “false”, default “true”)
  • allow_insert (“true” or “false”, default “false”)
  • allow_update (“true” or “false”, default “false”)
  • allow_delete (“true” or “false”, default “false”)
  • allow_import (“true” or “false”, default “false”)
  • bulk_actions_enabled (“true” or “false”, default “false”)
  • search_box_enabled (“true” or “false”, default “false”)
  • bulk_export_enabled (“true” or “false”, default “false”)
  • filter_field_name (field name(s) to be filtered)
  • filter_field_value (field value(s) to filter, performs a LIKE and therefor allows wildcards

Important

You need to explicitly grant access to tables you want to show on your web pages with user defined shortcodes. Tables will not be shown on your web pages without this step. Follow these steps to grant access to a table or view you allow users to add it’s content to your website:

  • From the menu click Settings > WP Data Access > tab Front-End Settings
  • Click on the table or view your want to grant access to (multiple selections possible)
  • Save your front-end settings

Example

[wpdadiehard table_name="customers"] 

Adding filters

Use parameters filter_field_name and filter_field_value to set a filter. For example:

[wpdadiehard table_name="customers" filter_field_name="last_name" filter_field_value="Jones"]

This will show only customers with last_name = “Jones”.

Adding a filter on multiple columns:

[wpdadiehard project_id="1" page_id="1" filter_field_name="first_name,last_name" filter_field_value="Grace,Jones"]

This will show only customers with first_name = “Grace” and last_name = “Jones”.

More complex filters

Please use the WHERE clause of your project page to add more complex filters (see image below – click to enlarge)

Video tutorial

Styling

> Styling shortcode wpdadiehard

Know limitations

  • Shortcode wpdadiehard does not work with all themes. Some themes are relying on the same parameters as shortcode wpdadiehard and return HTTP errors on specific page actions.
  • Data entry forms will return a HTTP 404 error for column names that interfere with WordPress, theme or other plugin parameters (like ‘id’, ‘name’, ‘search’, ‘s’, ‘page’, ‘action’, ?). Solution: rename your column. For example: rename column ‘name’ to ‘person_name’.
  • Media items are not supported in data entry forms.
  • You cannot use shortcode wpdadiehard if you have permalinks set to plain.
  • Shortcode wpdadiehard needs to be enabled (Settings > WP Data Access > Plugin).

Notes

Although I recommend to perform data and database administration tasks with the free version from the WordPress dashboard, the plugin allows real data diehards to perform data administration tasks on web pages as well. The WordPress dashboard protects you from hackers, especially if you have taken the necessary precautions. Web pages do not have that kind of security by default. If you decide to offer data administration on your web pages you need to take the necessary steps to secure these pages. Please be aware that every user who visits your website can modify your table data if you give users anonymous access. This is your own responsibility!

Was this article helpful to you? Yes No

Leave a Reply

Your email address will not be published. Required fields are marked *

two × four =