The Global $buddyforms
Form and Field Data
Every form is a post of the hidden custom post type "buddyforms".
All form data is stored in the hidden post meta field "_buddyforms_options"
In general all forms and form elements can be accessed like normal WordPress posts and the fields like normal post meta.
Tip: If you need to run thru all forms and form fields use the globale $post to avoid to many queries.
Use the Global $buddyforms
Every time a form gets updated, the global is updated also. The $buddyforms global is a container of all forms and fields.
So instead of many queries to get forms and field we just need to query one option from the option table to get all forms and data.
The global $buddyforms is stored in the site option "buddyforms_forms". Never access the option directly with get_option() always use the global $buddyforms.
The option buddyforms_forms is only a mirror of all forms and can only be used to access forms
Do not add your data to the global or update the option. Data stored in the buddyforms_forms option will be overwritten with every form update. The global will be regenerated during the form update.
The Global $buddyforms Structure
Array ( [form slug] => Array ( [name] => //The form name [slug] => //The form slug [singular_name] => //The form singular name [post_type] => //The attached post type [attached_page] => //The attached page [status] => //The post status [comment_status] => //Comments open or closed [admin_bar] => Array (  => Admin Bar // Add the form to the admin bar ) [edit_link] => //Rewrite edit links to point to the frontend form [after_submit] => //Display Message after submit or redirect? [after_submit_message_text] => The message text [list_posts_option] => //Filter list post options [form_fields] => Array //The array with the form elements ( [fe121e3ada] => Array ( [name] => Title [slug] => editpost_title [description] => [type] => title [validation_error_message] => This field is required. [validation_minlength] => 0 [validation_maxlength] => 0 [custom_class] => ) [0a2c910a37] => Array ( [name] => Content [slug] => editpost_content [description] => [type] => content [validation_error_message] => This field is required. [validation_minlength] => 0 [validation_maxlength] => 0 [custom_class] => ) ) ) next form... )
If you need to store data in the global $buddyforms, create a new form element type or use hooks and filters provided by the plugin to inject data form settings fields or custom options panels or boxes. All this data will be added to the global automatically
Was this documentation Helpful? Let us know if you have any question left so we can improve this documentation.