/custom-field-editor

Custom Field Editor - Wordpress Plugin

Primary LanguagePHP

custom-field-editor

Custom Field Editor - Wordpress Plugin

Custom Field Editor is a Wordpress Plugin spun off from the University of Lincoln ePortfolio project which allows forms to be set up on a web front end. Content added to these forms will be saved to the custom page meta, thereby allowing logged in users to make changes, save those changes and retrieve them later. Some applications could be creating a front end editor that certin users have access to, or allowing users to complete a pro-forma on a restricted site much as the portfolios project.

Forms are built using shortcodes. The form itself needs to be wrapped in a [cust_form] code with each element then called using a different code. Editing can be restricted to a group of user types by passing a comma delimited string in the "user" value. The codes available are:

[cust_form user="" lock_override=""] [cust_input name=""] [cust_text name="" rows="" max_words=""] [cust_wysiwyg name="" max_words=""] [cust_radio name="" values="Yes|No"] (Radio button values are pipe separated) [cust_check name=""] [cust_submit value=""] [cust_printmode printmode_on="" printmode_off=""] (Allows the form to be put into "print mode" where a logged in user can print the page without form elements being rendered)

An example form might look like:

[cust_form] [cust_input name="some_field"] [cust_input name="some_other_field"] [cust_check name="some_tickbox"] [cust_submit value="Save This Form"] [/cust_form]

The plugin also generates an options page which can be used to lock down all forms on a given site generated by the editor. If a single form needs to be made available, this lock can be overridden by passing TRUE in the "lock_override" value of the cust_form shortcode.

If you want to check edit restriction against custom user meta, you can use "cust_user_data" in the cust_form shortcode to pass in the ID of the data type.

Hooks

The plugin will ultimately have a number of hooks which will allow the injection of code to help other plugins interact with the forms, for example to lock the form if specific criteria are met. Current hooks are:

cust_pre_render - before the form is output