special offer desktop
Estimated reading: 8 minutes 114 views

PHP Filter Hooks – Bit Form

Here are some of the main Bit Forms PHP filter hooks:​

  1. bitform_filter_format_submitted_data
  2. bitform_filter_save_form_entry
  3. bitform_filter_user_details
  4. bitform_filter_save_entry_user_details
  5. bitform_filter_return_submit_success
  6. bitform_filter_submission_log_data
  7. bitform_filter_update_form_entry
  8. bitform_filter_update_entry_user_details
  9. bitform_filter_return_edit_success

bitform_filter_format_submitted_data

Description:

If you want to modify the submitted data before it is saved or update to the database, you can use this filter. The filter receives the submitted data as an array and the form ID as a parameter.

apply_filters('bitform_filter_format_submitted_data', $submitted_data, $this->form_id);

Usage:

The following example shows how to modify the submitted data before it is saved to the database.

add_filter('bitform_filter_format_submitted_data', 'your_function_name', 10, 3);

function your_function_name($submitted_data, $form_id) {
    // Modify the submitted data here
    return $submitted_data;
}

Parameters:

  • $submitted_data (array) (required) The submitted data as an array.
  • $form_id (int) (required) The form ID.
$submission_data = [
    // fieldKey => value
    'b1-1' => 'value1',
    'b1-2' => 'value2',
]

bitform_filter_save_form_entry

Description:

If you want to modify the form entry before it is saved to the database, you can use this filter. The filter receives the submitted data as an array and the form ID as a parameter.

apply_filters('bitform_filter_save_form_entry', $submitted_data, $this->form_id);

Usage:

The following example shows how to modify the form entry before it is saved to the database.

add_filter('bitform_filter_save_form_entry', 'your_function_name', 10, 3);

function your_function_name($submitted_data, $form_id) {
    // Modify the form entry here
    return $submitted_data;
}

Parameters:

  • $submitted_data (array) (required) The submitted data as an array.
  • $form_id (int) (required) The form ID.
$submission_data = [
    // fieldKey => value
    'b1-1' => 'value1',
    'b1-2' => 'value2',
]

bitform_filter_user_details

Description:

This filter available just modify the user details before it is save or update to the database, you can use this filter. The filter receives the user details as an array and the form ID as a parameter.

apply_filters('bitform_filter_user_details', $user_details, $this->form_id);

Usage:

The following example shows how to modify the user details before it is saved to the database.

add_filter('bitform_filter_user_details', 'your_function_name', 10, 3);

function your_function_name($user_details, $form_id) {
    // Modify the user details here
    return $user_details;
}

Parameters:

  • $user_details (array) (required) The user details as an array.
  • $form_id (int) (required) The form ID.
$user_details = [
    'ip' => 'user ip',
    'device' => 'user device',
    'id' => get_current_user_id(),
    'page' => 'user page',
    'time' => current_time('mysql'),
];

bitform_filter_save_entry_user_details

Description:

If you want to modify the user details before it is saved to the database, you can use this filter. The filter receives the user details as an array and the form ID as a parameter.

apply_filters('bitform_filter_save_entry_user_details', $user_details, $this->form_id);

Usage:

The following example shows how to modify the user details.

add_filter('bitform_filter_save_entry_user_details', 'your_function_name', 10, 3);

function your_function_name($user_details, $form_id) {
    // Modify the user details here
    return $user_details;
}

Parameters:

  • $user_details (array) (required) The user details as an array.
  • $form_id (int) (required) The form ID.
$user_details = [
    'ip' => 'user ip',
    'device' => 'user device',
    'id' => get_current_user_id(),
    'page' => 'user page',
    'time' => current_time('mysql'),
];

bitform_filter_return_submit_success

Description:

If you want to modify the Workflow return on submission before it is returned to the user, you can use this filter. The filter receives the wWork Flow Returned On Submit as a array and the form ID as a parameter.

apply_filters('bitform_filter_return_submit_success', $workFlowreturnedOnSubmit, $this->form_id);

Usage:

The following example shows how to modify the success message.

add_filter('bitform_filter_return_submit_success', 'your_function_name', 10, 3);

function your_function_name($workFlowreturnedOnSubmit, $form_id) {
    // Modify the success message here
    return $workFlowreturnedOnSubmit;
}

Parameters:

  • $workFlowreturnedOnSubmit (array) (required) The work flow returned on submit as an array.
  • $form_id (int) (required) The form ID.
$workFlowreturnedOnSubmit = [
    'fields' => [
        'b1-1' => 'value1',
        'b1-2' => 'value2',
    ],
    'message' => 'Form Submitted Successfully',
    'msg_id' => 0,
    'dflt_message' => 1,
    'redirectPage' => 'redirectPage url',
    'triggerData' => [
        'mail' => array(),
        'integrations' => array(),
        'dblOptin' => array(),
        'logID' => 0,
    ],
    'cron' => 1,
    'entry_id' => 0,
];

bitform_filter_submission_log_data

Description:

This filter is available just use to modify the submission log data before it is saved to the database. The filter receives the submission log data as an array, form ID, and the type as a parameter.

apply_filters('bitform_filter_submission_log_data', $submissionLogData, $this->form_id, $type);

Usage:

The following example shows how to modify the submission log data before it is saved to the database.

add_filter('bitform_filter_submission_log_data', 'your_function_name', 10, 3);

function your_function_name($submissionLogData, $form_id, $type) {
    // Modify the submission log data here
    return $submissionLogData;
}

Parameters:

  • $submissionLogData (array) (required) The submission log data as an array.
  • $form_id (int) (required) The form ID.
  • $type (string) (required) The type as create or update submission log.
$submissionLogData = [
    'user_id'       => 'user id',
    'action_type'   => 'type', // create, update
    'log_type'      => 'entry',
    'ip'            => 'user ip',
    'form_entry_id' => 'entry_id',
    'content'       => null,
    'form_id'       => 'form id',
    'created_at'    => current_time('mysql'),
];

bitform_filter_update_form_entry

Description:

If you want to modify the form entry before it is updated to the database, you can use this filter. The filter receives the updated data as an array and the form ID as a parameter.

apply_filters('bitform_filter_update_form_entry', $updatedValue, $this->form_id);

Usage:

The following example shows how to modify the form entry before it is updated to the database.

add_filter('bitform_filter_update_form_entry', 'your_function_name', 10, 3);

function your_function_name($updatedValue, $form_id) {
    // Modify the form entry here
    return $updatedValue;
}

Parameters:

  • $updatedValue (array) (required) The updated data as an array key as field key and value pair.
  • $form_id (int) (required) The form ID.
$updatedValue = [
    'b1-1' => 'value1',
    'b1-2' => 'value2',
]

bitform_filter_update_entry_user_details

Description:

This filter is available just use to modify the user details before it is updated to the database. This filter called when update form entry. The filter receives the user details as an array and the form ID as a parameter.

apply_filters('bitform_filter_update_entry_user_details', $user_details, $this->form_id);

Usage:

The following example shows how to modify the user details before it is updated to the database.

add_filter('bitform_filter_update_entry_user_details', 'your_function_name', 10, 3);

function your_function_name($user_details, $form_id) {
    // Modify the user details here
    return $user_details;
}

Parameters:

  • $user_details (array) (required) The user details as an array.
  • $form_id (int) (required) The form ID.
$user_details = [
    'ip' => 'user ip',
    'device' => 'user device',
    'id' => get_current_user_id(),
    'page' => 'user page',
    'time' => current_time('mysql'),
];

bitform_filter_return_edit_success

Description:

This filter is available just use to modify the Workflow return on edit form entry success it is returned to the edit success. This filter is called when Update Form Entry. The filter receives the Workflow Returned On Submit as a array and the form ID as a parameter.

apply_filters('bitform_filter_return_edit_success', $workFlowreturnedOnSubmit, $this->form_id);

Usage:

The following example shows how to modify the Workflow return on edit form entry success.

add_filter('bitform_filter_return_edit_success', 'your_function_name', 10, 3);

function your_function_name($workFlowreturnedOnSubmit, $form_id) {
    // Modify the success message here
    return $workFlowreturnedOnSubmit;
}

Parameters:

  • $workFlowreturnedOnSubmit (array) (required) The work flow returned on submit as an array.
  • $form_id (int) (required) The form ID.
$workFlowreturnedOnSubmit = [
    'fields' => [
        'b1-1' => 'value1',
        'b1-2' => 'value2',
    ],
    'message' => 'Form Submitted Successfully',
    'msg_id' => 0,
    'dflt_message' => 1,
    'redirectPage' => 'redirectPage url',
    'triggerData' => [
        'mail' => array(),
        'integrations' => array(),
        'dblOptin' => array(),
        'logID' => 0,
    ],
    'cron' => 1,
    'entry_id' => 0,
];
Share this Doc

PHP Filter Hooks

Or copy link

CONTENTS