Plugin Directory

Changeset 3458095


Ignore:
Timestamp:
02/10/2026 01:45:40 PM (7 weeks ago)
Author:
growify
Message:

Add Bricks theme form support

Location:
growify-ai/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • growify-ai/trunk/growify-ai.php

    r3454822 r3458095  
    33 * Plugin Name: Growify
    44 * Description: The plugin lets you integrate Growify.ai analytics into your WordPress site effortlessly. Track visits, WooCommerce conversions and form submissions automatically.
    5  * Version: 1.1
     5 * Version: 1.2
    66 * Author: Growify
    77 * Text Domain: growify-ai
     
    1515}
    1616
    17 define('GROWIFY_AI_VERSION', '1.1');
     17define('GROWIFY_AI_VERSION', '1.2');
    1818define('GROWIFY_AI_PLUGIN_DIR', plugin_dir_path(__FILE__));
    1919define('GROWIFY_AI_PLUGIN_URL', plugin_dir_url(__FILE__));
  • growify-ai/trunk/includes/class-growify-ai-forms.php

    r3451999 r3458095  
    2121    {
    2222        // Contact Form 7
    23         if (defined('WPCF7_VERSION')) {
    24             add_action('wpcf7_mail_sent', [$this, 'track_cf7']);
    25         }
     23        add_action('wpcf7_mail_sent', [$this, 'track_cf7']);
    2624
    2725        // WPForms
    28         if (function_exists('wpforms')) {
    29             add_action('wpforms_process_complete', [$this, 'track_wpforms'], 10, 4);
    30         }
     26        add_action('wpforms_process_complete', [$this, 'track_wpforms'], 10, 4);
    3127
    3228        // Gravity Forms
    33         if (class_exists('GFCommon')) {
    34             add_action('gform_after_submission', [$this, 'track_gravity'], 10, 2);
    35         }
     29        add_action('gform_after_submission', [$this, 'track_gravity'], 10, 2);
    3630
    3731        // Ninja Forms
    38         if (class_exists('Ninja_Forms')) {
    39             add_action('ninja_forms_after_submission', [$this, 'track_ninja_forms']);
    40         }
     32        add_action('ninja_forms_after_submission', [$this, 'track_ninja_forms']);
    4133
    4234        // Forminator
    43         if (class_exists('Forminator')) {
    44             add_action('forminator_custom_form_submit_before_set_fields', [$this, 'track_forminator'], 10, 3);
    45         }
     35        add_action('forminator_custom_form_submit_before_set_fields', [$this, 'track_forminator'], 10, 3);
    4636
    4737        // Fluent Forms
    48         if (defined('FLUENTFORM_VERSION')) {
    49             add_action('fluentform_before_insert_submission', [$this, 'track_fluent_forms'], 10, 1);
    50         }
     38        add_action('fluentform_before_insert_submission', [$this, 'track_fluent_forms'], 10, 1);
    5139
    5240        // Elementor Forms
    53         if (class_exists('\ElementorPro\Plugin') || function_exists('pro_elements_plugin_load_plugin')) {
    54             add_action('elementor_pro/forms/new_record', [$this, 'track_elementor_forms'], 10, 2);
    55         }
     41        add_action('elementor_pro/forms/new_record', [$this, 'track_elementor_forms'], 10, 2);
    5642
    5743        // Formidable Forms
    58         if (class_exists('FrmAppHelper')) {
    59             add_action('frm_after_create_entry', [$this, 'track_formidable'], 10, 2);
    60         }
     44        add_action('frm_after_create_entry', [$this, 'track_formidable'], 10, 2);
    6145
    6246        // Everest Forms
    63         if (class_exists('EverestForms')) {
    64             add_action('everest_forms_process_complete', [$this, 'track_everest_forms_complete'], 10, 4);
    65         }
     47        add_action('everest_forms_process_complete', [$this, 'track_everest_forms_complete'], 10, 4);
     48
     49        // Bricks Theme Forms
     50        add_filter('bricks/form/response', [$this, 'track_bricks_form'], 10, 2);
    6651    }
    6752
     
    387372
    388373    /**
     374     * Track Bricks Builder Forms
     375     *
     376     * @param array  $response Response data.
     377     * @param object $form     Bricks Form object.
     378     * @return array
     379     */
     380    public function track_bricks_form($response, $form)
     381    {
     382        $settings = $form->get_settings();
     383        $fields_data = [];
     384
     385        if (!empty($settings['fields'])) {
     386            foreach ($settings['fields'] as $field) {
     387                $field_id = isset($field['id']) ? $field['id'] : '';
     388                $field_label = isset($field['label']) ? $field['label'] : $field_id;
     389                $value = $form->get_field_value($field_id);
     390                if (is_array($value)) {
     391                    $value = implode(', ', $value);
     392                }
     393                $fields_data[] = [
     394                    'key' => $field_id,
     395                    'label' => $field_label,
     396                    'value' => $value
     397                ];
     398            }
     399        }
     400
     401        $form_name = isset($settings['submissionFormName']) ? $settings['submissionFormName'] : 'Bricks Theme Form';
     402
     403        $lead = $this->build_lead_payload($fields_data, 'Bricks Theme Forms', $form_name);
     404        $this->set_lead_cookie($lead);
     405
     406        return $response;
     407    }
     408
     409    /**
    389410     * Standardize field key or label for comparison
    390411     *
  • growify-ai/trunk/readme.txt

    r3454822 r3458095  
    44Requires at least: 5.0
    55Tested up to: 6.9
    6 Stable tag: 1.1
     6Stable tag: 1.2
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    6161= 1.1 =
    6262* Minor update
     63
     64= 1.2 =
     65* Added Bricks theme form support
     66* Simplified form hooks initiation
Note: See TracChangeset for help on using the changeset viewer.