Wordpress PDO Crud is powerful wordpress plugin to build forms and perform CRUD operation on frontend and backend both. It is built using PDOCrud php script which is an advance PHP based CRUD application.
PDOCrud application helps to perform complete crud operations by just writing 2-3 lines of code only. You can build forms directly from database tables in few seconds just by writing 2-3 lines of code. All insert/update/delete/view code is managed by the script.
Wordpress PDO Crud provides various shortcodes that can be used to perform the PDOCrud operations directly from backend so that a non technical person can also use the application.
You can use both shortcodes and core php code to perform CRUD operations. You can perform crud operation in frontend as well as backend.
You can perform crud operation on wordpress any table or if you want to use the some other database, you just need to change the config database settings only.
Please note that PDOCrud application uses bootstrap so make sure your theme css doesn’t conflict with bootstrap before using this plugin. In case your theme css conflict, you need to manage it yourself.
PDOCrud is dynamic CRUD generator application. It generates complete crud operation for you. You don't need to write code for CRUD operation(create, read, update, delete) operation. PDOCrud class does every thing on your behalf. All you need to do is to create object of class and call render function on the table for which you want to generate the CRUD operation. i.e. 2 lines of code and all operation of CRUD works.
For generating default crud table, you need to write 2 lines of code. It will create all insert/update/delete and view along with various other controls like pagination, search, records per page, sorting etc. This all options can be customized using various setting options available.
Using PDOCrud, you can build huge forms with many no. of fields in few seconds. You just need to write 2 lines of code and all operations will be managed by the database table. It doesn't matter how big or how small a table is, PDOCrud script generates form easily and also you don't need to write the code for database insert/update/delete/view also. All form submission and operations are done using ajax for faster operations
[pdocrud table="wp_options" render="crud"][/pdocrud]
$pdocrud = new PDOCrud();//create object of PDOCrud Class echo $pdocrud->dbTable("employee")->render(); // call render function on database table
Apply different skins(css) like as dark, green, advance skin Options and you Can improve your Form Desing
[pdocrud table="wp_options" render="crud"] [pc_setskin skin="dark"][/pc_setskin] [/pdocrud]
$pdocrud = new PDOCrud(); //You can apply different theme css simply by adding css in the skins folder. By default, //five css (default, dark, fair,green and advanced) are present. By default, default.css is applied. $pdocrud->setSkin("dark"); echo $pdocrud->dbTable("orders")->render();
Add css and js settings enqueue css in PDOCrud
[pdocrud table="wp_options" render="crud"] [pc_func enqueuecss bootstrap_rtl="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-rtl/3.2.0-rc2/css/bootstrap-rtl.min.css"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->enqueueCSS("jquery.mobile", "https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.css");//name of css and path of css echo $pdocrud->dbTable("users")->render();
Add css and js settings enqueue javascript in PDOCrud
[pdocrud table="wp_options" render="crud"] [pc_func enqueuejs googlemap="https://maps.googleapis.com/maps/api/js?key=AIzaSyAfp6Kg56vpI7GqJsDCTa577NnNDTnQiUw&callback=initMap"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->enqueueJs("googlemap", "http://maps.googleapis.com/maps/api/js");//name of js and path of js echo $pdocrud->dbTable("users")->render();
[pdocrud table="wp_options" render="crud"] [pc_func tablheadiing heading="Some heading"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); // Change table heading $pdocrud->tableHeading("Job Application Information"); echo $pdocrud->dbTable("job_application")->render();
[pdocrud table="wp_options" render="crud"] [pc_func tablesubheading sub_heading="Some sub heading"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); // Change table subheading $pdocrud->tableSubHeading("here you can add secondary information about the table"); echo $pdocrud->dbTable("job_application")->render();
[pdocrud table="wp_options" render="insertform"] [pc_func fielddesc option_name="some description"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->fieldDesc("first_name", "First Name");// Add field description $pdocrud->fieldDesc("last_name", "Last Name - some dummy description");// Add field description echo $pdocrud->dbTable("users")->render("insertform");
[pdocrud table="wp_options" render="insertform"] [pc_func fieldtooltip option_name="tooltip"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->fieldTooltip("user_name", "Please enter your user name to be used for login purpose");//tooltip echo $pdocrud->dbTable("users")->render("insertform");
Add field class and attributes in PDOCrud
[pdocrud table="wp_options" render="insertform"] [pc_func fieldcssclass option_name="class1,class2"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->fieldCssClass("first_name", array("class1", "class2"));// add css classes echo $pdocrud->dbTable("orders")->render("insertform");
[pdocrud table="wp_options" render="crud"] [pc_func coldataattr colname="option_name" width="500px"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->colDataAttr( "customer_name", array("width"=>"70px","colspan"=>2)); echo $pdocrud->dbTable("orders")->render();
[pdocrud table="wp_options" render="insertform"] [pc_func fieldattributes fieldname="option_name" data-type="email"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->fieldAttributes("last_name", array("data-type"=>"some_val"));// any attribute name and it's value $pdocrud->fieldAttributes("customer_name", array("placeholder"=>"name of customer"));//add placeholder attribute $pdocrud->fieldAttributes("order_status", array("placeholder"=>"status of order"));//add placeholder attribute echo $pdocrud->dbTable("orders")->render("insertform");
You can get the data order by ascending and descending by using dbOrderBy function.
[pdocrud table="wp_options" render="crud"] [pc_func dborderby orderbycols="option_name desc"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->dbOrderBy("id desc");//descending echo $pdocrud->dbTable("orders")->render();
[pdocrud table="wp_options" render="crud"] [pc_func crudcoltooltip colname="option_name" tooltip="Option name" ][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->crudColTooltip("first_name", "First name of user!"); echo $pdocrud->dbTable("users")->render();
[pdocrud table="wp_options" render="crud"] [pc_func recordsperpage val="20"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->recordsPerPage(12); echo $pdocrud->dbTable("products")->render();
[pdocrud table="wp_options" render="crud"] [pc_func currentPage pageno="2"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->currentPage(2);//set current page echo $pdocrud->dbTable("products")->render();
[pdocrud table="wp_options" render="crud"] [pc_func colRename user_pass="Password"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->colRename("first_name", "client name"); echo $pdocrud->dbTable("users")->render();
[pdocrud table="wp_options" render="crud"] [pc_func crudtablecol cols="first_name,last_name"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->crudTableCol(array("first_name","last_name")); echo $pdocrud->dbTable("users")->render();
[pdocrud table="wp_users" render="crud"] [pc_func crudremovecol cols="ID,user_login"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->crudRemoveCol(array("user_id")); echo $pdocrud->dbTable("users")->render();
By deafult, PDOCrud generates the field type based on the data type of the column and name of column in the database table. You can also change the type of field as required using the fieldTypes function.
[pdocrud table="wp_users" render="insertform"] [pc_func fieldtypes user_status="radio"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->fieldTypes("about_yourself", "textarea");//change about_yourself 'textarea' to input type text $pdocrud->fieldTypes("educational_status", "textarea"); // change educational_status 'input text' to textarea $pdocrud->fieldTypes("gender", "radio");//change gender to radio button $pdocrud->fieldDataBinding("gender", array("male","female"), "", "","array");//add data for radio button $pdocrud->fieldTypes("hobbies", "checkbox");//change hobbies to checkbox button $pdocrud->fieldDataBinding("hobbies", array("Dance","Art","Games"), "", "","array");//add data for checkbox button $pdocrud->fieldTypes("state", "select");//change state to select dropdown $pdocrud->fieldDataBinding("state", array("Andhra Pradesh","Bihar","Patna","Gujarat","Madhya Pradesh"), "", "","array");//add data using array in select dropdown $pdocrud->fieldTypes("country", "multiselect");//change country to multiselect dropdown $pdocrud->fieldDataBinding("country", array("India","Brazil","UK","Pakistan"), "", "","array");//add data using array in multiselect echo $pdocrud->dbTable("users")->render("insertform");
By deafult, PDOCrud generates the field type based on the data type of the column and name of column in the database table. You can also change the type of field as required using the fieldTypes function.
[pdocrud table="wp_options" render="insertform"] [pc_func fielddatabinding fieldname="user_status" datasource="active,inactive" key="", val="" bind = "array"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->fieldTypes("about_yourself", "textarea");//change about_yourself 'textarea' to input type text $pdocrud->fieldTypes("educational_status", "textarea"); // change educational_status 'input text' to textarea $pdocrud->fieldTypes("gender", "radio");//change gender to radio button $pdocrud->fieldDataBinding("gender", array("male","female"), "", "","array");//add data for radio button $pdocrud->fieldTypes("hobbies", "checkbox");//change hobbies to checkbox button $pdocrud->fieldDataBinding("hobbies", array("Dance","Art","Games"), "", "","array");//add data for checkbox button $pdocrud->fieldTypes("state", "select");//change state to select dropdown $pdocrud->fieldDataBinding("state", array("Andhra Pradesh","Bihar","Patna","Gujarat","Madhya Pradesh"), "", "","array");//add data using array in select dropdown $pdocrud->fieldTypes("country", "multiselect");//change country to multiselect dropdown $pdocrud->fieldDataBinding("country", array("India","Brazil","UK","Pakistan"), "", "","array");//add data using array in multiselect echo $pdocrud->dbTable("users")->render("insertform");
[pdocrud table="wp_users" render="crud"] [pc_func setsettings addbtn=false][/pc_func] [/pdocrud]
// You can directly hide/show various options using the config.php or you can also do in code also $pdocrud = new PDOCrud(); $pdocrud->setSettings("pagination", false); $pdocrud->setSettings("searchbox", false); $pdocrud->setSettings("deleteMultipleBtn", false); $pdocrud->setSettings("recordsPerPageDropdown", false); $pdocrud->setSettings("recordsPerPageDropdown", false); $pdocrud->setSettings("totalRecordsInfo", false); $pdocrud->setSettings("addbtn", false); $pdocrud->setSettings("editbtn", false); $pdocrud->setSettings("viewbtn", false); $pdocrud->setSettings("delbtn", false); $pdocrud->setSettings("actionbtn", false); $pdocrud->setSettings("checkboxCol", false); $pdocrud->setSettings("numberCol", false); $pdocrud->setSettings("printBtn", false); $pdocrud->setSettings("pdfBtn", false); $pdocrud->setSettings("csvBtn", false); $pdocrud->setSettings("excelBtn", false); echo $pdocrud->dbTable("orders")->render();
You can add recaptcha easily PDOCrud. You will only need to get the site key and secret key from google.
[pdocrud table="wp_users" render="insertform"] [pc_func recaptcha your-site-key="6LcHdQkUAAAAAO-tHrF_SonmjLIiuBjxjFmP4STd" site-secret="6LcHdQkUAAAAALqDxL86hJThSeWeKwCd34VOG0CT"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->recaptcha("your-site-key","site-secret");//site key and site secret echo $pdocrud->dbTable("employee")->render("insertform");
[pdocrud table="wp_users" render="crud"] [pc_func formdisplayinpopup][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->formDisplayInPopup();// call this function to show forms in popup echo $pdocrud->dbTable("orders")->render();
[pdocrud table="wp_users" render="insertform"] [pc_func fieldrenamelable user_pass="Password" ][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->fieldRenameLable("user_pass", "Password");//Rename label echo $pdocrud->dbTable("orders")->render("insertform");
[pdocrud table="wp_users" render="insertform"] [pc_func fieldhidelable colname="option_name" ][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->fieldHideLable("option_name");// Hide label echo $pdocrud->dbTable("orders")->render("insertform");
Redirect to some specified URL after form submission.
[pdocrud table="wp_users" render="insertform"] [pc_func formredirection url="https://www.google.co.in" ][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->formRedirection("http://google.com"); echo $pdocrud->dbTable("orders")->render("insertform");
[pdocrud table="wp_users" render="SQL"] [pc_func formredirection url="https://www.google.co.in" ][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->setQuery("select * from orders"); echo $pdocrud->render("SQL");
[pdocrud table="wp_users" render="crud"] [pc_func formaddcaptcha addcaptcha="captcha" ][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->formAddCaptcha("captcha");//to add captcha echo $pdocrud->dbTable("users")->render();
[pdocrud table="wp_users" render="insertform"] [pc_func fieldgroups name="user_status,display_name"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->fieldGroups("Name",array("user_status","display_name")); $pdocrud->fieldGroups("Personal",array("phone","gender","birth_date")); echo $pdocrud->dbTable("users")->render("insertform");
Change display order of fields in PDOCrud
[pdocrud table="wp_users" render="crud"] [pc_func fieldisplayorder cols="user_status,display_name"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->fieldDisplayOrder(array("user_login","user_pass","user_status", "display_name"));//display order of the fields(enter fields only till you want to change the order) echo $pdocrud->dbTable("users")->render();
You can set some default value of field in insert form. For example, in your table, you may have field name created by, which you don't want to fill by user (instead this you want this to be logged in user id) but you want to save that value in table.
[pdocrud table="wp_users" render="insertform"] [pc_func formfieldvalue display_name="Rita Soni"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->formFieldValue("display_name", "Rita Soni");//set some default value for customer Id echo $pdocrud->dbTable("ordertable")->render("insertform");
You can set some default value of field in insert form. For example, in your table, you may have field name created by, which you don't want to fill by user (instead this you want this to be logged in user id) but you want to save that value in table.
[pdocrud table="wp_users" render="insertform"] [pc_func fielddataattr colname="display_name"disabled="disabled"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); //or you can entirly hide that field also //$pdocrud->fieldHideLable("customer_id"); //$pdocrud->fieldDataAttr("customer_id", array("style"=>"display:none")); $pdocrud->fieldDataAttr("customer_id", array("disabled"=>"disabled")); echo $pdocrud->dbTable("ordertable")->render("insertform");
You can set some default value of field in insert form. For example, in your table, you may have field name created by, which you don't want to fill by user (instead this you want this to be logged in user id) but you want to save that value in table.
[pdocrud table="wp_users" render="insertform"] [pc_func formfields cols="user_status,display_name"][/pc_func] [/pdocrud]
$pdocrud = new PDOCrud(); $pdocrud->formFields(array("customer_id","order_amount","order_date","payment_method")); echo $pdocrud->dbTable("ordertable")->render("insertform");