ouun / zammad-wp

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

Sending HTML Form throws fatal error (missing option "url") #28

Closed Tranquillius closed 1 month ago

Tranquillius commented 2 years ago

2022/07/13 13:47:05 [error] 525834#525834: *25962 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught RuntimeException: Missing option "url" in /var/www/wordpress/wp-content/plugins/zammad-wp/vendor/zammad/zammad-api-client-php/src/HTTPClient.php:51 Stack trace:

0 /var/www/wordpress/wp-content/plugins/zammad-wp/vendor/zammad/zammad-api-client-php/src/Client.php(50): ZammadAPIClient\HTTPClient->__construct()

1 /var/www/wordpress/wp-content/plugins/zammad-wp/includes/classes/Zammad.php(73): ZammadAPIClient\Client->__construct()

2 /var/www/wordpress/wp-content/plugins/zammad-wp/includes/classes/Zammad.php(55): ZammadWp\Zammad->client()

3 /var/www/wordpress/wp-content/plugins/zammad-wp/includes/functions/hf-plugin-integration.php(125): ZammadWp\Zammad->__construct()

4 /var/www/wordpress/wp-includes/class-wp-hook.php(307): zammad_hf_process_form_action()

5 /var/www/wordpress/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()

6 /var/www/wordpress/wp-includes/plugin.php(476): WP_Hook->do_action()

Tranquillius commented 2 years ago

Some info: /var/log/nginx/error.log Testet with Wordpress 6, PHP (7.4, 8.0, 8.1), HTML Forms Plugin 1.3.23

ouun commented 2 years ago

@Tranquillius please note that this package requires a bit of PHP and debugging knowledge. The reason for the error is in your error message above: Missing option "url". Please follow the wiki and next time a simple greeting would be nice, too.

Kind regards

Tranquillius commented 2 years ago

Dear ouun,

the constant ZAMMAD_URL is defined in the wp-config.php. The plugin is able to receive the groups via API from the Zammad instance. If I want to submit the form, this error is thrown.

Kind regards to Munich.

linksblinker commented 1 year ago

Hey ooun,

I'm sorry, but running in exactly similar problem as described by Tranquilius.

The latest version of your plugin is installed at WordPress 6.2.2. All plugin options are correctly set accordingly to the documentation in wiki.

In backend, the plugin is able to receive the groups from my Zammad instance.

Any other function doesn't work due the issue reported by Tranquilius (Missing option "url"). For me it seems, configuration is simply not present / initialized in case of frontend rendering.

I would be thankful, if you can have a look.

Best regards from Aurich

Thomas

ouun commented 1 year ago

Hi @linksblinker,

I am currently not actively using the package and won't have time to have a closer look for the next two weeks. However it uses the official Zammad PHP SDK to connect to your Zammad instance. Can you please try to hard code your Zammad URL in the following line and test again? https://github.com/ouun/zammad-wp/blob/2854267e435aeca65894cbf193f434c39b749e8c/includes/classes/Zammad.php#L67

Kind regards,

Philipp

linksblinker commented 1 year ago

Philipp,

thanks for your very quick reply.

I've hardcoded url and http_token directly in Zammand.php. Now it works as expected.

Regardless of further investigation, I'm glad to get things working.

Thanks!

Best regards,

Thomas

ouun commented 1 year ago

OK, thanks for the info. That will help to debug it. However it is not a good idea to hardcode it as the next update will override it.

Would be great if you could go sure, that you have set define('ZAMMAD_HTTP_TOKEN', 'YOUR_ZAMMAD_TOKEN') & define('ZAMMAD_URL', 'YOUR_ZAMMAD_URL') in your wp-config.php.

Because this should work then as they are set here: https://github.com/ouun/zammad-wp/blob/2854267e435aeca65894cbf193f434c39b749e8c/includes/classes/Zammad.php#L37 https://github.com/ouun/zammad-wp/blob/2854267e435aeca65894cbf193f434c39b749e8c/includes/classes/Zammad.php#L43C13-L43C13

Thanks for helping debugging this.

Tranquillius commented 1 year ago

Dear Philipp,

I checked your hint twice. Same issue. Now by hardcoding both constants, your plugin works expected. Thanks so far.

Best regards,

Alex

F3rr021 commented 1 month ago

Dear Philipp,

I checked your hint twice. Same issue. Now by hardcoding both constants, your plugin works expected. Thanks so far.

Best regards,

Alex

Hi bro, i have same issus, but i change hardcode url, but dont work. where i have to change? 'url' => $this->url, ? on here 'url'? or here $this->url, ? ty.

ouun commented 1 month ago

@F3rr021 you will need a basic understanding of how to work with the code as this is out of scope. I still plan to create a UI version of Zammad WP so that everyone can work with it. Until then, please ask someone how to help you with this.