Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Plugin Config Empty

I'm working on a plugin that needs to store a URL. Plugin::getConfig is returning a blank object with nearly no data in it.

so in my config.php file I've got the following php:

return array (
'url' => new TextboxField ( array (
'id' => 'timetrex_url',
'label' => 'Enter the url of your timetrex installation',
'configuration' => array (
'desc' => 'Enter the url of your timetrex installation',
'size'=>100 )
) ),

and in my instantiated plugin i've got this:

function getURL(){
return $this->getConfig()->get('timetrex_url');

It was working, but then I changed some file names during dev. I've been trying to figure it out but getConfig is returning a new instance of config with zero data in it. Anyone know why? Anyone know how to fix it?


  • MORE INFO: I am instantiating the plugin manually to call some render code in the <head> section I've noticed that I'm missing an ID as the constructor argument. This same Id argument is used to select the config during getConfig(). What should the constructor's argument be?
  • UPDATE & SOLUTION: The issue was that I was instantiating the plugin with no ID. this override of the constructor fixes my problem and gives access to the plugin's data as expected.

    function __construct(){
    //first we need to get the id of the plugin
    .' WHERE install_path="plugins/TTpunchbutton"';
    $id = db_result(db_query($sql));

  • I don't understand.  Where did you put the __construct code at?  Hopefully this isn't too old a thread.
Sign In or Register to comment.