Page tree
Skip to end of metadata
Go to start of metadata

 

Description

This function lists information for the cPanel account's Site Publisher websites.

Note:

To retrieve the list of Site Publisher website information, the function queries the configurations.json file in each domain's document root. For more information, read our Guide to Site Publisher Templates documentation.

Examples 


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/SiteTemplates/list_user_settings

Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// List information for the account's Site Publisher websites.
$templates = $cpanel->uapi(
    'SiteTemplates', 'list_user_settings'
);

Note:

For more information, read our Guide to the LiveAPI System.

 

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# List information for the account's Site Publisher websites.
my $templates = $cpliveapi->uapi(
    'SiteTemplates', 'list_user_settings',
);

Note:

For more information, read our Guide to the LiveAPI System.

 

 cPanel Template Toolkit
<!-- List the account's backup files. -->
[% data = execute( 'SiteTemplates', 'list_user_settings' ); %]
[% FOREACH q = data %]
     <p>
         [% q %]
     </p>
[% END %]

Note:

For more information, read our Guide to Template Toolkit documentation. 

 

 Command Line
uapi --user=username SiteTemplates list_user_settings

Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • We introduced this functionality in cPanel & WHM version 56.

 Output (JSON)
{  
   "status":1,
   "errors":null,
   "messages":null,
   "data":[  
      {  
         "template_settings":{  
            "is_empty":0,
            "path":"/var/cpanel/customizations/site_templates",
            "template":"mytemplate"
         },
         "homedir":"/home/example",
         "documentroot":"/home/example/public_html",
         "serveralias":[  
            "www.example.com"
         ],
         "type":"main_domain",
         "domain":"example.com"
      }
   ],
   "metadata":{  
      "transformed":1
   }
}

Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

   

Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
 hash

An unnamed hash of each domain's site template information.

This hash includes the homedir, documentroot, type, and domain returns, the serveralias array, and the template_settings hash.

 

template_settings

hash

A hash of template settings.

The function returns this hash in the unnamed hash.

This hash includes the is_empty, path, and template returns.

Important:

This hash also contains the user's website content. The template provider determines these values.

  • For information about the content for cPanel-provided templates, read our Guide to Site Publisher Templates documentation.
  • For more information about other templates, contact the template provider.
 

is_empty

Boolean

Whether the domain's configurations.json file exists and contains template information.

The function returns this value in the template_settings hash.

  • 1 — The configurations.json file exists and contains template information.
  • 0 — The configurations.json file does not exist, or does not contain template information.
0

path

string

The template directory path.

The function returns this value in the template_settings hash.

  • /var/cpanel/customizations/site_templates/ — Templates that the root user owns.
  • /home/username/var/cpanel/reseller/site_templates/ — Templates that a reseller owns, where username represents the reseller's username.
  • /usr/local/cpanel/etc/site_templates/ — cPanel-provided templates.

 Click to view...

/var/cpanel/customizations/site_templates

template

string

The template's name.

The function returns this value in the template_settings hash.

The name of a template, as it appears in the configurations.json file.

mytemplate

homedir

string

The user's home directory.

The function returns this value in the unnamed hash.

The absolute path to the cPanel account's home directory./home/example

documentroot

string

The domain's document root.

The function returns this value in the unnamed hash.

The absolute path to the directory's document root inside of the account's home directory./home/example/public_html

serveralias

array

An array of the domain's aliases.

The function returns this array in the unnamed hash.

An array of one or more of the domain's aliases.www.example.com

type

string

The domain's type.

The function returns this value in the unnamed hash.

  • main — The main domain.
  • sub — A subdomain.
main

domain

string

The domain name.

The function returns this value in the unnamed hash.

A valid domain name.example.com