Jump to content

Bug in hook+api ?


LosBooom

Recommended Posts

Hello.

Can someone explain why this is happening?

I have this code in includes/hooks:

<?php

if (!defined("WHMCS")) {
    die("This file cannot be accessed directly");
}

add_hook('TicketOpen', 1, function($vars){
	$ticketid = 111115; // use this ticket for testing
    
    $result = localAPI('AddTicketReply', [
        'ticketid' => $ticketid,
        'message' => 'Text message',
        'adminusername' => 'Robot admin',
        ]);
});

?>

My idea is this: the user opens a ticket, a hook is triggered, a message from Robot Admin is sent to the test ticket.

The problem is that if the user attaches files to the ticket, the robot will repeat it in my test ticket.

Edited by LosBooom
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated