WordPress.org

Ready to get started?Download WordPress

Forums

Forms: 3rd-Party Integration
[resolved] Use of hooks - How to implement on new plugin? (2 posts)

  1. klode
    Member
    Posted 10 months ago #

    After some time studying the right method to implement hooks on preview plugin (CF7 3rd Party Integration), now I get notice of this new plugin.

    So my problem is this:

    1. I have a form with CF7 with some fields;
    2. I create a new Service with CF7 3-rd Party;
    3. I set as "submission Url" a php file on my plugin folder (*1);
    4. I create a new PHP file with class "Cf73rdParty_NewUserRegistrationCallbacks";
    5. I want to make some check before sending emails;

    So:
    (1*) What this file must to be return as data? And how can I use the Class of the service to make some check before send emails?

    And again...

    For a better information about using hooks, I found a little problem. I use a Class, like mailchimp service and all the other services on third-parties folder of the plugin.

    add_action('Cf73rdPartyIntegration_service_a0', array(&$this, 'data_registration_execute'), 10, 2);

    This is the action in the __construct method of the class.

    The method:

    public function data_registration_execute($response, $results){...}

    require on your code the using the "&" reference for $results, but I get (in debug mode) this error:

    Warning: Parameter 2 to Cf73rdParty_NewUserRegistrationCallbacks::data_registration_execute() expected to be a reference, value given

    So, the "&" reference is removed. In this mode, this method works fine.

    With the action "Cf73rdPartyIntegration_onfailure", I can get the "errors" element from the action "Cf73rdPartyIntegration_service_a0", so I can check which type of error I get.
    But the command:

    $cf7->skip_mail=true;

    it seems to work properly, but it empties all fields on module.

    Does I made something wrong?

    I know, my English is not so good! I hope you can understand my question.

    http://wordpress.org/extend/plugins/forms-3rdparty-integration/

  2. klode
    Member
    Posted 10 months ago #

    I have found a solution:

    Add solution for 3rd party integration and managing errors

    I hope this can help somebody.

Reply

You must log in to post.

About this Plugin

About this Topic