{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"Sample Hook","description":"Developer documentation for the WHMCS API — the","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"sample-hook","__idx":0},"children":["Sample Hook"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/includes/hooks/samplehook.php"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The hook below will execute whenever the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ClientAdd"]}," event occurs:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\n\n/**\n * Register hook function call.\n *\n * @param string $hookPoint The hook point to call.\n * @param integer $priority The priority for the hook function.\n * @param string|function The function name to call or the anonymous function.\n *\n * @return This depends on the hook function point.\n */\n\n if (!defined('WHMCS'))\n     die('You cannot access this file directly.');\n\n function create_forum_account($vars) {\n\n     $firstname = $vars['firstname'];\n     $lastname = $vars['lastname'];\n     $email = $vars['email'];\n\n     // Add the code to create a remote forum account here.\n\n }\n\n add_hook('ClientAdd', 1, 'create_forum_account');\n"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Note"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For a full list of available hooks, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/hooks/hook-index/"},"children":["Hooks Index"]},"."]}]}]},"headings":[{"value":"Sample Hook","id":"sample-hook","depth":1}],"frontmatter":{"title":"Sample Hook","seo":{"title":"Sample Hook"}},"lastModified":"2026-08-03T17:00:42.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/hooks/sample-hook","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}