Hello There!

I am using osTicket 1.17.2 on which I'm trying to install this 3rd party plugin: https://github.com/clonemeagain/osticket-plugin-mentioner

It doesn't work on my system as-is so I'm trying to customize it.

Specifically the plugin is unable to get its config correctly.
This is what I get on $this->getConfig() :

{
	"table":"ost2_config",
	"instance":null,
	"form":null,
	"_config":{
		"at-mentions":true,
		"by-agents-only":true,
		"sbh":true,
		"notice-subject":"You were mentioned in ticket #%{ticket.number}",
		"notice-template":"\n<h3><strong>Hi %{recipient.name.first},..."
	},
	"config":[],
	"section":null,
	"section_column":"namespace",
	"session":null,
	"defaults":[]
}

Totally different config is stored in the database.
As far as I understand this is because it determines "instance" as null and falls back to default values.

I am new to PHP and osTicket in specifically. Can I get a piece of advise on this particular case?
I was not able to find any documentation on how to develop plugins. If there is one, please show me where to find it.
Thanks.

  • sam77am
    Hi there! For those who will search something like that.
    A community member t-oster found a solution for another plugin that seems to work for my install of Mentioner plugin as well. Here is the patch:
    https://github[dot]com/clonemeagain/attachment_preview/pull/62/files

    As far as I understand the root of the initial problem is that getConfig() method only works fine within the bootstrap method of the plugin. The author implemented some workaround to override the original getConfig() method by his own.

SeuzRoman changed the title to Adapt a 3rd party plugin for 1.17.x.

@SeuzRoman this forum is intended to support osTicket and osTicket released plugins. We do not privide support here for 3rd party plugins or mods. Please reach out to the author for support. Thank you.

    ntozier
    My question is not exactly on a particular 3rd party plugin. It's about how to develop and install plugins in general. I believe this is a feature of osTicket itself.

    I managed to find this manual.
    https://github.com/poctob/OSTEquipmentPlugin/wiki/Plugin-Development-Introduction
    However, it doesn't consider instances which I believe is a new concept created in 1.17. I need help to figure out the instances.

      SeuzRoman

      Unfortunately we don’t have such documentation on that. You can look at the changes we made to core plugins and see how you can update your plugin.

      Cheers.

      4 days later

      For those who will search for it.

      I wasn't able to figure out the problem with the plugin so I used this duck tape.
      Since the plugin utilizes only default config values no matter what the actual are, I just hardcoded my necessary values as defaults in the code. Like this:

                  'override-notifications' => new BooleanField([
                      'label' => $__("Override Notifications"),
                      'hint' => $__('Can be dangerous..'),
      				'default' => false
                  ]),
                  'notice-hash' => new BooleanField([
                      'label' => $__('Notice #Mentions'),
                      'hint' => $__('Sends notices to staff mentioned with #name'),
      				'default' => true
                  ]),

      Works for me (and for me only).

        22 days later

        SeuzRoman I installed the mentioner plugin to the latest version of osticket but it is not working.
        Can you confirm where should I add the above code? It would really helpful.

          sam77am
          I made those modifications to config.php file of the plugin.

          Adding collaborators by '@' works fine.
          '#' mentions work fine on test server and don't work on prod. Don't know why yet.

            SeuzRoman I modified that but still not working for me. Have you created some instances in the plugin configuration page under admin?

              3 months later

              sam77am
              Hi there! For those who will search something like that.
              A community member t-oster found a solution for another plugin that seems to work for my install of Mentioner plugin as well. Here is the patch:
              https://github[dot]com/clonemeagain/attachment_preview/pull/62/files

              As far as I understand the root of the initial problem is that getConfig() method only works fine within the bootstrap method of the plugin. The author implemented some workaround to override the original getConfig() method by his own.

              10 months later

              Hi, I don't understand how to fix the problem. Which file should I modify?

              Write a Reply...