Software Development Kit

cPanel & WHM's API [+] cPanel & WHM's API [-]


Modules and Plugins [+] Modules and Plugins [-]


cPanel & WHM Hooks [+] cPanel & WHM Hooks [-]


cPAddons (Site Software) [+] cPAddons (Site Software) [-]


System Administration [+] System Administration [-]


Developer Software [+] Developer Software [-]


Back to All Documentation



integrationblogcta.jpg

Hookable Events

For cPanel & WHM 11.32

Summary

Hookable events are specific points in cPanel & WHM where additional, custom code can be executed.

A canonical reference of hookable events sorted by category is provided below. In most cases, developers will use these hookable events defined by cPanel. However, it is possible for developers to define their custom hookable events within their own cPanel code, such as a custom cPanel module.

How cPanel & WHM defines hookable events

Three attributes define a hookable event:

Category

A logical group, such as Whostmgr, System, or PkgAcct.
Event
The primary event performed by cPanel & WHM such as, Account::Create, upcp, or Restore.
Stage
The location of the trigger that will run the hook action code, relative to the primary event, e.g., pre, post, or preExtract.

Other attributes include:

Blocking

Whether the returned failure from a hook action code will prevent the execution of the cPanel & WHM primary event. As a rule of thumb, only hookable events with pre defined in their stage attribute can block; however, not all of the pre stage hookable events can block.
Escalate Privileges
Whether the hookable event is able to escalate privileges prior to executing the hook action code. Hookable events that occur in code running as the cPanel user can escalate privileges. Only hook action code implemented in the form of a script can escalate privileges. Hook action code implemented with Perl modules always execute as the defined user, specified in Action Code Run As.
Action Code Run As
The system user that will own the process which executes the hook action code.

note Note: The last 3 attributes above are implicit implementation details related to the cPanel & WHM code which dispatches the respective hookable event. If the blocking and escalateprivs attributes are present for a given event, then the associated hook is allowed to describe the rollback and escalateprivs attributes when registering the Standardized Hook.

Canonical reference of hookable events

Hookable events, as defined above, are logically grouped by category. The following table, organized by those categories, provides a canonical reference to the various hookable events:

Category Description
Stats Functions Statistics processing categories.
Password Functions Categories related to passwords.
cPanel Functions Categories related to cPanel functionality.
Package Account Functions Packaging accounts categories.
WHM Functions Categories related to WHM functionality.
System Functions Categories related to system functionality.

Custom hookable events

The Standardized Hooks System does not restrict hookable events to the canonical reference of hookable events. By defining hookable events in custom cPanel modules, it is possible for non-cPanel code to contain arbitrary hookable events. That is, if a piece of non-cPanel code — loaded and running in a cPanel process — requests the execution of a custom hookable event, and there is a hook action defined in the hooks database, it will be treated the same as if it were a native cPanel & WHM hookable event.

For more information, please review the advanced usage document.

Topic revision: r7 - 20 Mar 2013 - 17:57:04 - Main.JenniferDoubrava
SoftwareDevelopmentKit.StdHooksEvents moved from Sandbox.StdHooksEvents on 12 Mar 2012 - 20:46 by Main.JustinSchaefer - put it back