Array
(
    [0] => Warning
    [1] => Undefined array key "language"
    [2] => /home/whmcsdev/public_repo/wbteampro.major-release/installation/modules/addons/wbteampro/initialize.php
    [3] => 282
)
Array
(
    [0] => Warning
    [1] => Undefined property: stdClass::$state
    [2] => /home/whmcsdev/public_repo/wbavatax.master/installation/modules/addons/wbavatax/hooks.php
    [3] => 942
)
Array
(
    [0] => Deprecated
    [1] => htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated
    [2] => /home/whmcsdev/public_repo/wbavatax.master/installation/modules/addons/wbavatax/hooks.php
    [3] => 279
)
9.2 - Plugins Reference - Knowledgebase - WHMCS Dev
Dev License: This installation of WHMCS is running under a Development License and is not authorized to be used for production use. Please report any cases of abuse to abuse@whmcs.com

9.2 - Plugins Reference Print

  • 3

System Plugins allow you to integrate code directly into wbTeamPro via a set of events triggered during runtime.  Included with your installation package is a plugin example that can be used as reference while learning to develop within wbTeamPro.

Plugin File Structure

Plugins are stored within the wbTeamPro addons folder /modules/addons/wbteampro/plugins/, with each plugin being entirely contained within a sub-folder.

The plugin model requires that the following files be included (where "example" is the unique plugin key):

  • /modules/addons/wbteampro/plugins/example/example.php
    This is the core plugin file that will be loaded and examined for plugin events.
  • /modules/addons/wbteampro/plugins/example/example.xml
    This is the plugin package information.
  • /modules/addons/wbteampro/plugins/example/lang/english.php
    This is the default language file for the plugin.

Plugin Information XML

The plugin package XML defines several important aspects of a plugin to the wbTeamPro system.  Plugins may include parameter fields that can be used to allow customization of the plugin once installed.  The example.xml file shows how the XML file should be constructed, and examples of the available parameter fields.

{wbshowcode:wbTeamPro/v30x/plugins/example/example.xml}

Plugin Event PHP

The plugin package Core PHP file defines the event methods that will be triggered during runtime. 

  • Plugins are zoned for either client, admin, or all and are loaded upon wbTeamPro initialization
  • Every plugin must have a unique plugin "key" name, such as "example" for the Example plugin
  • The plugin class is defined by appending the plugin key to the prefix "wbTeamPro_Plugin_"
  • Plugin events are methods named for the appropriate event trigger
  • All event methods will receive the same parameters ( $data, $params )
      $data:Array - The instance payload
      $params:Array - The instance options

The example.php file shows how to to properly construct the plugin. 

{wbshowcode:wbTeamPro/v30x/plugins/example/example.php}

Plugin Language PHP

The plugin package optionally allows for language translation files to be included.  Language files should each be named after the language options available, as shown in the example below:

{wbshowcode:wbTeamPro/v30x/plugins/example/lang/english.php}

Plugin Event Reference

The following is a complete list of the plugin event triggers currently available.

  system_onRunCron - During cron after validating session

table_onAfterCopy_Project -> After performing copy function
table_onAfterStore_Action -> After storing database record
table_onAfterStore_File -> After storing database record
table_onAfterStore_Project -> After storing database record
table_onAfterStore_TicketXref -> After storing database record
table_onAfterStore_Timelog -> After storing database record
table_onAfterStore_Topic -> After storing database record
table_onBeforeDelete_Action -> Before deleting database record
table_onBeforeDelete_File -> Before deleting database record
table_onBeforeDelete_Project -> Before deleting database record
table_onBeforeDelete_TicketXref -> Before deleting database record
table_onBeforeDelete_Timelog -> Before deleting database record
table_onBeforeDelete_Topic -> Before deleting database record

plugin_onAfterInstall -> After plugin installed
plugin_onBeforeUninstall -> Before plugin un-installed
plugin_onAfterEnable -> After plugin enabled
plugin_onBeforeDisable -> Before plugin disabled

admin_onAfterLoadTask - During controller after loading task
admin_onBeforeLoadTask - During controller before loading task
admin_onFinalizeView - During controller after collecting output
admin_onHeaderOutput - Executes after output of html header
admin_onInitialize - During controller startup after startup
admin_onPrepareView - During controller before preparing ouput

admin_onDuringRender_PluginEditForm -> During plugin detail form display
admin_onAfterSave_PluginEditForm -> After saving plugin detail form

admin_onBeforeRender_ProjectEditTabs - During project edit tabs display
admin_onDuringRender_ProjectEditForm - During project detail form display
admin_onDuringRender_TicketProjectTabForm - During project tab form on Support Ticket display

admin_onAfterStore_Action - After saving before rendering
admin_onAfterStore_File - After saving before rendering
admin_onAfterStore_Project - After saving before rendering
admin_onAfterStore_TicketXref - After saving before rendering
admin_onAfterStore_Topic - After saving before rendering
admin_onAfterStore_Timelog - After saving before rendering

client_onAfterLoadTask - During controller after loading task
client_onBeforeLoadTask - During controller before loading task
client_onFinalizeView - During controller after collecting output
client_onHeaderOutput - Executes after output of html header
client_onInitialize - During controller startup after startup
client_onPrepareView - During controller before preparing ouput
client_onBeforeRender_ProjectEditTabs - During project edit tabs display (added v3.0.16)
client_onAfterStore_Action - After saving before rendering
client_onAfterStore_File - After saving before rendering
client_onAfterStore_Topic - After saving before rendering

Was this answer helpful?

« Back

Powered by WHMCompleteSolution