ouun / zammad-wp

Zammad WordPress integration
GNU General Public License v2.0
27 stars 5 forks source link

Plugin not working with HTML Forms #4

Closed mkellenberger closed 3 years ago

mkellenberger commented 3 years ago

I just installed Zammad-WP and HTML Forms. HTML Forms works just fine, but once Zammad-WP is activated I can't add the "Create Zammad Ticket" action, not even "Send Mail" works anymore. Is there a known issue? I tested it on two installs with same result.

ouun commented 3 years ago

Thanks for the notice, @mkellenberger. I will have a look asap, sounds like a JavaScript issue.

ouun commented 3 years ago

@mkellenberger there seems to be an issue in the Zammad API package for which I just opened a PR: https://github.com/zammad/zammad-api-client-php/issues/36

Do you see such error notice with WP debug mode: https://codex.wordpress.org/WP_DEBUG

If yes a temporary workaround is to set only one access credential. Please set either username/password, http_token or oauth2_token.

If the above is not the reason for your issue, please let me know what error you received and you can also debug the connection to Zammad with define('ZAMMAD_DEBUG', true);.

mkellenberger commented 3 years ago

I just tested that out. No errors like linked. Also now errors when Zammad-Debug is on. Problem ist I can't add the action on HTML forms...the buttons don't work at all, not even the standard "Send mail". Bildschirmfoto 2021-02-25 um 20 00 52

ouun commented 3 years ago

@mkellenberger I am afraid I can not reproduce your issue. If you also do not find a JavaScript error in your Browser console, I can not solve it without access to your setup for debugging. Can you please also deactivate all other plugins except HTML Forms and Zammad WP and test again?

terdinatore commented 3 years ago

Hi Philipp(@ouun), I do experience the same problem as @mkellenberger does.

I have you attached two screenshots of the HTML Forms dialogue, one with the plugin enabled the other without it. For me clicking on any of the action buttons has no effect. Additionally, there seem to be issues with a dummy Send Email action that I created beforehand. Also, the error below is raised in the WP debug.log:

[01-Mar-2021 20:21:32 UTC] PHP Fatal error:  Uncaught Error: Class 'ZammadWp\Zammad' not found in /var/www/html/wp-content/plugins/zammad-wp/includes/functions/hf-plugin-integration.php:29
Stack trace:
#0 /var/www/html/wp-includes/class-wp-hook.php(287): {closure}(Array, '$index')
#1 /var/www/html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array)
#2 /var/www/html/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
#3 /var/www/html/wp-content/plugins/html-forms/views/tab-actions.php(64): do_action('hf_output_form_...', Array, '$index')
#4 /var/www/html/wp-content/plugins/html-forms/src/admin/class-admin.php(229): require('/var/www/html/w...')
#5 /var/www/html/wp-includes/class-wp-hook.php(287): HTML_Forms\Admin\Admin->tab_actions(Object(HTML_Forms\Form))
#6 /var/www/html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array)
#7 /var/www/html/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
#8 /var/www/html/wp-content/plugins/html-forms/views/page-edit-form.php(56): do_action('hf_admin_output...', Object(HTML_Fo in /var/www/html/wp-content/plugins/zammad-wp/includes/functions/hf-plugin-integration.php on line 29

That looked like a permission error, so I checked permissions and changed the owner of the files. Then I got a new one, see below. This could be a credential issue, but I don't know where to check if this is the case. Also I don't see any API requests to my Zammad web server. So I think the API client is not working/created/existent.

[01-Mar-2021 20:39:15 UTC] PHP Notice:  Undefined variable: zammad in /var/www/html/wp-content/plugins/zammad-wp/includes/functions/hf-plugin-integration.php on line 33
[01-Mar-2021 20:39:15 UTC] PHP Fatal error:  Uncaught Error: Call to a member function group() on null in /var/www/html/wp-content/plugins/zammad-wp/includes/functions/hf-plugin-integration.php:33
Stack trace:
#0 /var/www/html/wp-includes/class-wp-hook.php(287): {closure}(Array, '$index')
#1 /var/www/html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array)
#2 /var/www/html/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
#3 /var/www/html/wp-content/plugins/html-forms/views/tab-actions.php(64): do_action('hf_output_form_...', Array, '$index')
#4 /var/www/html/wp-content/plugins/html-forms/src/admin/class-admin.php(229): require('/var/www/html/w...')
#5 /var/www/html/wp-includes/class-wp-hook.php(287): HTML_Forms\Admin\Admin->tab_actions(Object(HTML_Forms\Form))
#6 /var/www/html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array)
#7 /var/www/html/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
#8 /var/www/html/wp-content/plugins/html-forms/views/page-edit-form.php(56): do_action('hf_admin_output...', Object in /var/www/html/wp-content/plugins/zammad-wp/includes/functions/hf-plugin-integration.php on line 33

After all, my most educated guess seems to be that, the ZammadAPIClient is not included in the zipped plugin and therefore the HTML Forms part of the plugin won't work.

It would at least explain why you couldn't reproduce the error. This is not reflected yet in the documentation, so I can understand why @mkellenberger fell for it. I can do a pull request with a warning if you would like me to. Also, it would be nice to have a good debug documentation, but I think you should write it, as you have the best insights on how to work with your code.

PS: Would it be possible to include the ZammadAPIClient in the zipped plugin?

Screenshot_zammadwp_disabled

Screenshot_zammadwp_enabled

ouun commented 3 years ago

Thanks @terdinatore for your comprehensive issue description. That helps a lot and yes, I only install the plug-in with Composer, so your guess might me right that the zip is missing something. I'll check that tomorrow. Thanks for testing and your patience.

ouun commented 3 years ago

@terdinatore & @mkellenberger I just released another version, can you please both try it and report back if this fixes your issues: https://github.com/ouun/zammad-wp/releases/tag/v0.8.3

Thanks!

terdinatore commented 3 years ago

@terdinatore & @mkellenberger I just released another version, can you please both try it and report back if this fixes your issues: https://github.com/ouun/zammad-wp/releases/tag/v0.8.3

Thanks!

The new version fixed the ZIP installer! Thank you, Philipp for the great work. I will be opening two more issues, but they are rather informative ones to help others that may have trouble getting the plugin to work.

ouun commented 3 years ago

As this is fixed I am closing it without waiting for @mkellenberger approving it. But please feel free to report back if you still have issues.

ghost commented 2 years ago

Hi @ouun,

I would like to restart this ticket, because I have the same problem as above. That is, nothing happens when I click on the "Send Email" or "Create Zammad Ticket" button.

I read the thread and I have v0.8.3 of the Zammad for WordPress plugin. I also set the Debug mode, but I didn't see any errors related to the plugin.

Can you help me find out what is causing the problem?

Thanks you, I wish you a nice day, see you soon!

ouun commented 2 years ago

Hi @Brendyyyp, can you please check if you find any issues in your Browser Console and also check for possible PHP errors from your logs? Also can you please go sure that you either set username/password, http_token or oauth2_token. Zammad breaks if you add multiple API credentials.

ghost commented 2 years ago

Hi @ouun,

I checked the console and I have no PHP errors related to your plugin. I have deleted many plugins to see if there is an incompatibility issue but nothing, I can't get the "Create Zammad Ticket" button to work.

Also, I have noted my ZAMMAD_URL / ZAMMAD_USERNAME and ZAMMAD_PASSWORD, since the chat is working correctly and I am retrieving the data in my Zammad back office.

Can you help me further, please? I can give you temporary access to my staging site if you want to take a closer look.

Thanks to you, have a nice day!

ghost commented 2 years ago

Hi @ouun, Would you rather I open another ticket about this?