What is a CRUD system?
The abbreviation CRUD comes from Create, Update, Update, Delete – which, in other words, means a data management system. In web terms it would most probably mean a piece of software which allows you to manage entries in your database, usually MySQL, PostgreSQL, MS SQL, or other.
A great, and, maybe, the most popular example of a CRUD system is phpMyAdmin – excellent software that is used by almost every web developer to manage MySQL data online.
Why would you need a CRUD system in WordPress?
WordPress itself is a powerful CMS (Content Management System), which is a specific kind of CRUD system, but sometimes you encounter a situation when you need to manage database data directly from WordPress front-end. Among others it can be one of these situations:
- You would like to have a bugtracker on your WordPress site
- You want to allow some of the users to edit some data from your site front-end without allowing them to see your WordPress site admin panel.
- You have a requirement to allow some users to edit a DB table, e.g., modify a placed order, edit some personal data, etc.
And similar requests.
How to integrate a CRUD system in your WordPress site?
The easiest solution – try to find a suitable plugin
First – make sure you really need one. Many of the tasks are typical and you can probaly find a plugin that would suit your needs. E.g. if you need a bugtracker, as mentioned above, you can check and download this or this one. And if you need something more generic, like editing different MySQL tables from WordPress front-end, try wpDataTables – you can see here how the front-editing works, it is also fully responsive. You can purchase the plugin herehere.
If you still need one, you’d need to do some serious development to get it done.
Start a new WordPress plugin
If you think that no plugin fits your needs, create your own one! Start by reading this nice tutorial on creating a WordPress plugin from scratch.
You would need these plugin components:
- A front-end which would render the data and the editor.
- Javascript (jQuery) code which would send the data to the server and receive it from there.
- AJAX action hook in your plugin’s PHP code which would do the actual CRUD actions on the back-end.
- A configuration file, or, better, a back-end WordPress Admin panel page which would “tell” the plugin which tables to modify, and which SQL queries to do (in case you use a MySQL table).
It is also possible to implement this without AJAX – but non-AJAX crud systems look obsoltete nowadays.
Creating a CRUD system in WordPress
No comments:
Post a Comment