Hello everyone,

I'm currently trying to create a plugin for OSTicket. Due to the fact that there's no official documentation or guide I'm following this one. It's a bit outdated, but most of it still seems to be correct. For me it doesn't work though, I'm currently stuck with the problem that I can't get my code to be called.

Creating a menu entry works, the link is correct. But when I click it, the signal below is not sent, so my callback function is not called, and the dispatcher doesn't handle the link in any way either. I don't quite understand how that is supposed to work, i.e. the signal and the dispatcher working together.

Beyond that, it seems like I need controllers to handle the different actions and requests. I'm also not sure how these are supposed to be set up.

Thanks in advance for any help.

  • osTicket-Version: v1.12.5 (933bb1f) — Aktuell
  • Server-Software: Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.4.2
  • MySQL-Version: 10.4.11
  • PHP-Version: 7.4.2

Here are the relevant parts of the code:

class MyPlugin extends Plugin {
[...]   
   function bootstrap(){  
      $this->createStaffMenu();
      // Call our function when signal is sent.
      Signal::connect ( 'apps.scp', array (
         'MyPlugin',
         'callbackDispatch'
      ));
   }

   function createStaffMenu() {
      Application::registerStaffApp ( 'My Plugin', 'apps/dispatcher.php/myplugin', array (
         iconclass => 'faq-categories' 
      ) );
   }
[...]
   static public function callbackDispatch($object, $data) {
      error_log("callbackDispatch()");   // This point is never reached.
      // URL routing stuff...
   }
[...]
23 days later

So in the meantime, I figured it out.
The current version of the dispatcher for staff applications seems to be broken since this commit, as some commenters there already pointed out. So I commented out the first block of the scp/apps/dispatcher.php file and then it worked, the callbackDispatch() method gets called and from there one can handle the links, i.e. when you hover over the "Applications" tab and click on your plugin, it works.
Which brings me to the second issue: When you click on the "Application" tab directly, it redirects to scp/apps.php but that file does not exist.

Any help would be appreciated.

Cheers

2 months later

I have this issue too, since I bought software-mods osTicket Reports and Agent Activity Plugins, the applications menu appeared, but clicking on the Applications menu calls http://support.x.y.z/scp/apps.php which says "File not found.” Which block did you exactly comment in the scp/apps/dispatcher.php file, I am using 1.14.2.

7 months later
Write a Reply...