Disclaimer: We accept no responsibility for any data loss occurring as a result of using this feature.
When WS Form read or writes submission meta data, it can be filtered using WordPress filter hooks.
The filter hooks are:
wsf_submit_meta_update($meta_value, $field_id)
wsf_submit_meta_read($meta_value, $field_id)
These filters enable you to modify meta values before they are written to the database (i.e. when a form is submitted), and modify meta values when they are read from the database (e.g. when a submission is viewed).
Update
When WS Form writes submission meta data to the database, it passes through this filter hook:
wsf_submit_meta_update($meta_value, $field_id)
$meta_value
is the value being written.$field_id
is the ID of the field on your form.
An example of manipulating meta values using this filter hook is shown below:
// Add filter for handling submit meta updates add_filter('wsf_submit_meta_update', 'wsf_submit_meta_update_callback', 10, 2); // Hook function for wsf_submit_meta_update filter function wsf_submit_meta_update_callback($meta_value, $field_id) { // Switch by field ID switch($field_id) { // Field ID 123 (Change this to your field ID) case 123 : // In this example, we'll convert the meta_value to upper case // Use your own function here $meta_value = strtoupper($meta_value); break; } return $meta_value; }
Read
When WS Form reads submission meta data from the database, it passes through this filter hook:
wsf_submit_meta_read($meta_value, $field_id)
$meta_value
is the read value from the database.$field_id
is the ID of the field on your form.
An example of manipulating meta values using this filter hook is shown below:
// Add filter for handling submit meta reads add_filter('wsf_submit_meta_read', 'wsf_submit_meta_read_callback', 10, 2); // Hook function for wsf_submit_meta_read filter function wsf_submit_meta_read_callback($meta_value, $field_id) { // Switch by field ID switch($field_id) { // Field ID 123 (Change this to your field ID) case 123 : // In this example, we'll convert the meta_value to lower case // Use your own function here $meta_value = strtolower($meta_value); break; } return $meta_value; }