Difference between revisions of "Template:Hook:AfterRegistrarFunction"

From WHMCS Documentation

m (Example)
 
(7 intermediate revisions by the same user not shown)
Line 3: Line 3:
  
 
===Description===
 
===Description===
 +
__NOEDITSECTION__
 
{{Hook_Categories_Vertical| type = Domains}}{{{description|}}}
 
{{Hook_Categories_Vertical| type = Domains}}{{{description|}}}
  
Line 34: Line 35:
  
 
===Return Type===
 
===Return Type===
None
+
{{#if:{{{returnType|}}}|{{{returnType}}}|None}}
  
 
===Example===
 
===Example===
  
 
<source lang="php">
 
<source lang="php">
add_hook('{{hookName}}', 1, function($vars) {
+
add_hook(
    if($vars['functionExists'] && !$vars['functionSuccessful']) {
+
    'AfterRegistrarGetContactDetails',
    //do something on function existing and failure
+
    1,
    $domain = $vars['params']['sld'] . '.' . $vars['params']['tld'];
+
    function($vars)
 +
    {
 +
        if (
 +
            $vars['functionExists']
 +
            && !$vars['functionSuccessful']
 +
        ) {
 +
            //do something on function existing and failure
 +
            $domain = $vars['params']['sld'] . '.' . $vars['params']['tld'];
 +
        }
 
     }
 
     }
});
+
);
 
</source>
 
</source>
 +
{{#if:{{{additionalExample|}}}|{{{additionalExample}}}}}
  
 
===Changelog===
 
===Changelog===

Latest revision as of 13:30, 7 July 2015

Description

This page has moved to https://developers.whmcs.com/hooks/


Hook Type

Standard (What does this mean?)

Input Parameters

Variable Type Notes
params Array An array of parameters passed to the registrar function
results Array An array of results returned from the registrar function call
functionExists Boolean Does the function exist?
functionSuccessful Boolean Was the function call successful?

Return Type

None

Example

add_hook(
    'AfterRegistrarGetContactDetails',
    1,
    function($vars)
    {
        if (
            $vars['functionExists']
            && !$vars['functionSuccessful']
        ) {
            //do something on function existing and failure
            $domain = $vars['params']['sld'] . '.' . $vars['params']['tld'];
        }
    }
);


Changelog