zaus / forms-3rdparty-integration

Wordpress Plugin - Forms 3rdparty Integration - a plugin to help integrate 3rdparty services with common WP Forms plugins like Contact Form 7 and Gravity Forms
http://wordpress.org/plugins/forms-3rdparty-integration/
47 stars 14 forks source link

Debug Mode Not Working #80

Closed bcartine closed 7 years ago

bcartine commented 7 years ago

I am trying to use the 3rd party Integration plugin with Ninja Forms. I checked both “Debug Mode” and “Logging Fallback”, but I am not getting any debug e-mail, and there is no debug output in the error_log file on the server.

I also am confused about how to add a "Hook". Do I need to add a whole new Class to the pHP functions file, or can I just add a function? I added a new "Service", selected a Ninja Form to "attach", and added a Class to the theme functions. The Class constructor has the following:

add_action('Forms3rdPartyIntegration_service_a2', array(&$this, 'my_forms_action'), 10, 2);

and the Class body contains: public function my_forms_action($response, &$results)

but the function is not getting called.

zaus commented 7 years ago

Regarding debug mode not working -- I've worked on some hosting providers that basically don't allow emails, or they get blocked or sent to spam, which is why I created the logging fallback. However, the logging fallback was intended to work with WP_DEBUG_LOG rather than PHP logging, so not sure if that's your issue there, I never really tried it without WP_DEBUG mode enabled.

You can hook however you want -- functionally or object-oriented. I tend to prefer using objects (i.e. a class with its own functions as you've done) for better encapsulation, just so you don't have to prefix every function name and worry about conflicts.

My guess is that you set it up correctly but either:

  1. You're not hooking to the correct service ('a2' would be the 3rd service since it starts with index 0)
  2. You haven't created an instance of your class (i.e. declaring after your class new MyClass()) -- you'll usually see this in my plugins as the "// Engage!" line at the bottom of the main plugin file