Guide to Standardized Hooks

Introduction

Standardized Hooks trigger applications when cPanel & WHM performs an action. Use this system to execute custom code (hook action code) to customize how cPanel & WHM functions in specific scenarios (hookable events). For example, you could use this system to make certain that a script runs each time that a user creates an account.

Note:

For a step-by-step tutorial to create and register a hook, read our Tutorial - Create a Standardized Hook documentation. 

 

Basic usage

Each standardized hook is comprised of a hookable event, a hook action, and hook registration.

To create a new standardized hook, perform the following steps:

  1. Select a hookable event. — Hookable events set the action that triggers a hook, and whether the hook triggers before or after the event.

  2. Write your custom hook action code.
  3. Register the hook. — Use the manage_hooks utility to connect (register) the hook action code with the event.
    • The system includes a hooks registry for each hookable event. This allows hooks from your application to coexist with another application's hooks that reference the same event.
    • cPanel & WHM provides a CLI utility to manage standardized hooks.

The Standardized Hook System database

Standardized Hooks System data resides in the /var/cpanel/hooks.yaml file. This database is the authoritative reference for all standardized hook data. The Standardized Hooks System also maintains a cached copy of this database in the  /var/cpanel/hooks.cache  file. The cache file regenerates automatically whenever you query the Standardized Hooks System is queried internally or through a management utility. 

Warning:

Do not edit this file by hand. Instead, manage Standardized Hooks with the /usr/local/cpanel/bin/manage_hooks utility.

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....