{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Admin Services Tab","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":"admin-services-tab","__idx":0},"children":["Admin Services Tab"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Admin Services Tab functions allow definition of extra fields to appear on the product details in the admin area."," ","Used for informational output, or for settings and values stored in custom tables or outside WHMCS."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["WHMCS uses this in the core system for our licensing addon module."," ","The license specific fields of the allowed system are set and viewed from the product details."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["There are 2 functions relating to the services tab - ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AdminServicesTabFields"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AdminServicesTabFieldsSave"]},"."," ","The first of these allows definition of the extra fields to output."," ","The latter allows handling any input on submission/save, if required."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["So on to an example, below we show you how to define 4 extra fields."," ","This example shows an input, dropdown, textarea and info only output."," ","The examples continues to update them in a custom table of the database via the save event."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"example-admin-services-tab-function","__idx":1},"children":["Example Admin Services Tab Function ",{"$$mdtype":"Tag","name":"a","attributes":{"id":"example-function"},"children":[]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"function mymodule_AdminServicesTabFields($params) {\n\n    $result = select_query(\n        \"mod_customtable\",\n        \"\",\n        array(\"serviceid\" => $params['serviceid'],)\n    );\n    $data = mysql_fetch_array($result);\n    $var1 = $data['var1'];\n    $var2 = $data['var2'];\n    $var3 = $data['var3'];\n    $var4 = $data['var4'];\n\n    $fieldsarray = array(\n     'Field 1' => '<input type=\"text\" name=\"modulefields[0]\" size=\"30\" value=\"'.$var1.'\" />',\n     'Field 2' => '<select name=\"modulefields[1]\"><option>Val1</option</select>',\n     'Field 3' => '<textarea name=\"modulefields[2]\" rows=\"2\" cols=\"80\">'.$var3.'</textarea>',\n     'Field 4' => $var4, # Info Output Only\n    );\n    return $fieldsarray;\n\n}\n\nfunction mymodule_AdminServicesTabFieldsSave($params) {\n    update_query(\"mod_customtable\",array(\n        \"var1\"=>$_POST['modulefields'][0],\n        \"var2\"=>$_POST['modulefields'][1],\n        \"var3\"=>$_POST['modulefields'][2],\n    ),array(\"serviceid\"=>$params['serviceid']));\n}\n"},"children":[]}]},"headings":[{"value":"Admin Services Tab","id":"admin-services-tab","depth":1},{"value":"Example Admin Services Tab Function","id":"example-admin-services-tab-function","depth":2}],"frontmatter":{"title":"Admin Services Tab","seo":{"title":"Admin Services Tab"}},"lastModified":"2026-08-03T17:00:42.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/provisioning-modules/admin-services-tab","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}