• Resolved s.edel

    (@sedel)


    Hi,

    I try to interract with SugarCRM using 3rdparty service for Contact-Form-7.
    In documentation, i found that I need to use Hooks. Ok, nice.
    So I check the hooks option and now I have the following : add_filter(‘Cf73rdPartyIntegration_service_filter_post_5’, array(&$this, ‘YOUR_FILTER’), 10, 4);
    I need to insert something to functions.php.

    But what and where ???
    I found functions.php but I’m not sure is the good one.

    Does someone has an easy sample of using add_filter with function prototype, etc.

    Thanks.
    Regards,
    s.edel

    https://www.ads-software.com/extend/plugins/contact-form-7-3rd-party-integration/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter s.edel

    (@sedel)

    I’ve found how to use add_filter hooks.
    Here is a step by step of what I do :

    1)
    copy file
    /wp-content/plugins/contact-form-7-3rd-party-integration/3rd-parties/listrak/functions.listrak.php
    to folder
    wp-content/themes/cloriatotheme/cloriatotheme/functions/
    rename it like you want (i.e 3rdparty-services-filters.php)
    (Note that your destination folder name depends on your theme)

    2)
    edit functions.php situated in your theme folder and insert a line to include your filters.php file
    like this : require_once ($functions_path . ‘3rdparty-services-filters.php’);

    3)
    edit filters.php file to add your own filter / convertion logic

    <?php

    if(!class_exists(‘Cf73rdParty_ListrakCallbacks’)):

    class Cf73rdParty_ListrakCallbacks {
    public function __construct(){
    add_filter(‘Cf73rdPartyIntegration_service_filter_post_5’, array(&$this, ‘sugar_filters’), 10, 4);
    }

    public function sugar_filters($values, &$service, &$cf7){
    if (isset($values[“description”]))
    {

    $array = $values[“description”];
    // Convert var if it’s an array
    if (is_array($array))
    $values[“description”] = implode(“, “, $array);
    }

    return $values;
    }
    }

    $cf73rdpartycallback_instance = new Cf73rdParty_ListrakCallbacks();
    endif; //class-exists
    ?>

    Regards,
    Sébastien

    Plugin Author zaus

    (@zaus)

    Glad you figured out the solution. Is there anything I can do in the documentation to make stuff like this easier to find?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Contact-Form-7: 3rd-Party Integration] How to interract with CF7 fields using hooks’ is closed to new replies.