Closed IchHabeHunger54 closed 1 month ago
I think you miss 2 parameters in the method call of addAction. Both are usually optional when you only pass one parameter to the callback but since you need more, you have to add priority and parameter count. Id recommend to checkout the eventy documentation https://github.com/tormjens/eventy. So basicially you could try this
//...
class TicketChangelogServiceProvider extends ServiceProvider
{
//...
public function hooks(): void
{
\Eventy::addAction('conversation.subject_changed', function($conversation, $user, $prev_subject) {
if ($conversation->getSubject() == $prev_subject) return;
$thread = new Thread();
//...
$thread->save();
}, 20, 3); // 20 is base prio and 3 = parameter count
}
}
@sofl88's suggestion is correct.
Yes, this solved it, thank you very much.
PHP version: 8.2.20 FreeScout version: 1.8.152 Database: MySQL /
PostgreSQLAre you using CloudFlare:Yes/ No Are you using non-official modules: Yes /NoHello, plugin dev here. First off, if there's a better place to ask for plugin dev support, feel free to direct me there instead.
I tried making a simple plugin that adds a lineitem thread when the title of a conversation changes (event
conversation.subject_changed
), using the following code:However, whenever I change the title, I get an error telling me to check my internet connection. What actually happens, though, is the following message appearing in the logs (with more internal calls at the bottom that I removed here, and the email address is censored):
I'm not all too familiar with PHP, but for me this looks like my code expects three parameters (which I took from the Conversation class in the source code), however the code only provides one JSON object. What can/should I do here?
Thank you in advance for your response.