Create new Form Element

You can add new form elements to BuddyForms to support your plugin specific fields or add a form element with a special functionality.  

With the buddyforms_form_element_add_field filter you can add a new form element to the Form Builder.

Parameters

  • $form_fields (array) The Form Fields.
  • $form_slug (string) The Form Slug
  • $field_type (string) The Field Type like Textbox, Hidden...
  • $field_id (string) with mod5 Generated Field ID

Return Value

  • $form_fields (array)

Code Example

I have created a gist as starting point with an BuddyForms New Form Element Example

You can save the value stored in $_POST[ $customfield[ 'slug' ] ] or use for your purpose.

To store the value as custom post meta you can use update_post_meta function Read the WordPress codex for more information: http://codex.wordpress.org/Function_Reference/update_post_meta

Still need help? Contact Us Contact Us